diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsReturngoodsDetailedDao.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsReturngoodsDetailedDao.java index f28e0527..70e17763 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsReturngoodsDetailedDao.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/ITocofsReturngoodsDetailedDao.java @@ -40,10 +40,24 @@ public interface ITocofsReturngoodsDetailedDao extends IBaseDao tocofsReturngoodsDetailedEntityList) throws Exception; + /** + * 批量新增或者修改,TOB退货-库存 + * + * @author liuyang + */ + void entityInsertOrUpdateBatchByTobRerturnStockV2(List tocofsReturngoodsDetailedEntityList) throws Exception; + /** * 批量新增或者修改,TOB退货-确认收入 * * @author liuyang */ void entityInsertOrUpdateBatchByTobRerturnTran(List tocofsReturngoodsDetailedEntityList) throws Exception; + + /** + * 批量新增或者修改,TOB退货-确认收入 + * + * @author liuyang + */ + void entityInsertOrUpdateBatchByTobRerturnTranV2(List tocofsReturngoodsDetailedEntityList) throws Exception; } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/impl/TocofsReturngoodsDetailedDaoImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/impl/TocofsReturngoodsDetailedDaoImpl.java index f1f49e16..b51f1a87 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/impl/TocofsReturngoodsDetailedDaoImpl.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/dao/impl/TocofsReturngoodsDetailedDaoImpl.java @@ -19,7 +19,7 @@ public class TocofsReturngoodsDetailedDaoImpl extends MybatisGenericDao tocofsReturngoodsDetailedEntityList) throws Exception { insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDetailedDaoImpl.entityInsertOrUpdateBatch", tocofsReturngoodsDetailedEntityList); } - + @Override public void entityInsertOrUpdateBatchByTocRerturnStock(List tocofsReturngoodsDetailedEntityList) throws Exception { insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDetailedDaoImpl.entityInsertOrUpdateBatchByTocRerturnStock", tocofsReturngoodsDetailedEntityList); @@ -35,9 +35,19 @@ public class TocofsReturngoodsDetailedDaoImpl extends MybatisGenericDao tocofsReturngoodsDetailedEntityList) throws Exception { + insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDetailedDaoImpl.entityInsertOrUpdateBatchByTobRerturnStockV2", tocofsReturngoodsDetailedEntityList); + } + @Override public void entityInsertOrUpdateBatchByTobRerturnTran(List tocofsReturngoodsDetailedEntityList) throws Exception { insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDetailedDaoImpl.entityInsertOrUpdateBatchByTobRerturnTran", tocofsReturngoodsDetailedEntityList); } + + @Override + public void entityInsertOrUpdateBatchByTobRerturnTranV2(List tocofsReturngoodsDetailedEntityList) throws Exception { + insert("com.hzya.frame.plugin.lets.ofs.dao.impl.TocofsReturngoodsDetailedDaoImpl.entityInsertOrUpdateBatchByTobRerturnTranV2", tocofsReturngoodsDetailedEntityList); + } } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml index 9b9b3ba1..b3ce7554 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml @@ -828,7 +828,7 @@ insert into tocofs_returngoods_detailed(receiptId, receiptCode, refOrderId, refOrderDetailId, sourceOrderCode, sourceLineNum, clientCode, companyCode, facilityCode, skuCode, skuName, requestQty, receivedQty, openQty, quantityUM, totalWeight, totalVolume, totalVolumeWeight, totalAmount, weightUM, volumeUM, inventorySts, inTransInvId, closed, created, createdBy, lastUpdated, lastUpdatedBy, discountPrice, mainTableId, newTransmitInfo, newPushDate, newState, newSystemNumber, newSystemPrimary, newTransmitInfo2, newPushDate2, newState2, newSystemNumber2, newSystemPrimary2, newTransmitInfo3, newPushDate3, newState3, newSystemNumber3, newSystemPrimary3, newTransmitInfo4, newPushDate4, newState4, newSystemNumber4, newSystemPrimary4, businessDate, refundedAt, businessType, def1, def2, def3, def4, def5, def6, def7, def8, def9, def10, def11, def12, def13, def14, def15, def16, def17, def18, def19, def20, def21, def22, def23, def24, def25, def26, def27, def28, def29, def30, def31, def32, def33, def34, def35, def36, def37, def38, def39, def40) values - + (#{entity.receiptid},#{entity.receiptcode},#{entity.reforderid},#{entity.reforderdetailid},#{entity.sourceordercode},#{entity.sourcelinenum},#{entity.clientcode},#{entity.companycode},#{entity.facilitycode},#{entity.skucode},#{entity.skuname},#{entity.requestqty},#{entity.receivedqty},#{entity.openqty},#{entity.quantityum},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.totalamount},#{entity.weightum},#{entity.volumeum},#{entity.inventorysts},#{entity.intransinvid},#{entity.closed},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby},#{entity.discountprice},#{entity.maintableid},#{entity.newtransmitinfo},#{entity.newpushdate},#{entity.newstate},#{entity.newsystemnumber},#{entity.newsystemprimary},#{entity.newtransmitinfo2},#{entity.newpushdate2},#{entity.newstate2},#{entity.newsystemnumber2},#{entity.newsystemprimary2},#{entity.newtransmitinfo3},#{entity.newpushdate3},#{entity.newstate3},#{entity.newsystemnumber3},#{entity.newsystemprimary3},#{entity.newtransmitinfo4},#{entity.newpushdate4},#{entity.newstate4},#{entity.newsystemnumber4},#{entity.newsystemprimary4},#{entity.businessdate},#{entity.refundedat},#{entity.businesstype},#{entity.def1},#{entity.def2},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.def6},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11},#{entity.def12},#{entity.def13},#{entity.def14},#{entity.def15},#{entity.def16},#{entity.def17},#{entity.def18},#{entity.def19},#{entity.def20},#{entity.def21},#{entity.def22},#{entity.def23},#{entity.def24},#{entity.def25},#{entity.def26},#{entity.def27},#{entity.def28},#{entity.def29},#{entity.def30},#{entity.def31},#{entity.def32},#{entity.def33},#{entity.def34},#{entity.def35},#{entity.def36},#{entity.def37},#{entity.def38},#{entity.def39},#{entity.def40}) @@ -881,8 +881,8 @@ insert into tocofs_returngoods_detailed(id,newPushDate3,newTransmitInfo3,newState3,newSystemNumber3,newSystemPrimary3) values - - (#{entity.id},#{entity.newpushdate3},#{entity.newtransmitinfo3},#{newstate3},#{newsystemnumber3},#{newSystemPrimary3}) + + (#{entity.id},#{entity.newpushdate3},#{entity.newtransmitinfo3},#{entity.newstate3},#{entity.newsystemnumber3},#{entity.newSystemPrimary3}) on duplicate key update id = values(id), @@ -897,8 +897,8 @@ insert into tocofs_returngoods_detailed(id,newPushDate4,newTransmitInfo4,newState4,newSystemNumber4,newSystemPrimary4) values - - (#{entity.id},#{entity.newpushdate4},#{entity.newtransmitinfo4},#{newstate4},#{newsystemnumber4},#{newsystemprimary4}) + + (#{entity.id},#{entity.newpushdate4},#{entity.newtransmitinfo4},#{entity.newstate4},#{entity.newsystemnumber4},#{entity.newsystemprimary4}) on duplicate key update id = values(id), @@ -913,8 +913,8 @@ insert into tocofs_returngoods_detailed(id,newPushDate,newTransmitInfo,newState,newSystemNumber,newSystemPrimary) values - - (#{entity.id},#{entity.newpushdate},#{entity.newtransmitinfo},#{newstate},#{newsystemnumber},#{newSystemPrimary}) + + (#{entity.id},#{entity.newpushdate},#{entity.newtransmitinfo},#{entity.newstate},#{entity.newsystemnumber},#{entity.newsystemprimary}) on duplicate key update id = values(id), @@ -925,12 +925,26 @@ newSystemPrimary = values(newSystemPrimary) + + + insert into tocofs_returngoods_detailed(id,newPushDate,newTransmitInfo,newState) + values + + (#{entity.id},#{entity.newpushdate},#{entity.newtransmitinfo},#{entity.newstate}) + + on duplicate key update + id = values(id), + newPushDate = values(newPushDate), + newTransmitInfo = values(newTransmitInfo), + newState = values(newState) + + insert into tocofs_returngoods_detailed(id,newPushDate2,newTransmitInfo2,newState2,newSystemNumber2,newSystemPrimary2) values - - (#{entity.id},#{entity.newpushdate2},#{entity.newtransmitinfo2},#{newstate2},#{newsystemnumber2},#{newsystemprimary2}) + + (#{entity.id},#{entity.newpushdate2},#{entity.newtransmitinfo2},#{entity.newstate2},#{entity.newsystemnumber2},#{entity.newsystemprimary2}) on duplicate key update id = values(id), @@ -941,6 +955,19 @@ newSystemPrimary2 = values(newSystemPrimary2) + + + insert into tocofs_returngoods_detailed(id,newPushDate2,newTransmitInfo2,newState2) + values + + (#{entity.id},#{entity.newpushdate2},#{entity.newtransmitinfo2},#{entity.newstate2}) + + on duplicate key update + id = values(id), + newPushDate2 = values(newPushDate2), + newTransmitInfo2 = values(newTransmitInfo2), + newState2 = values(newState2) + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java index 638b5bbe..e49c23b3 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java @@ -466,7 +466,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { */ private List filterDataRowsAsPushOrFailedStock(List allTocofsSaleoutDetailedEntityList, List headerDetailsDtoList) throws Exception { List targetHeaderDetailsDtoList = new ArrayList<>(); - if (allTocofsSaleoutDetailedEntityList != null && allTocofsSaleoutDetailedEntityList.size() > 0 && headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { + if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { //字段Y(成功)或者为H(待处理)可以视为成功,完成了小段业务闭环的数据行 String succeseeY = "Y"; String succeseeH = "H"; @@ -480,12 +480,14 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { DetailsDto detailsDto = details.get(j); Boolean isSuccess = false; String newstate = null; - for (int k = 0; k < allTocofsSaleoutDetailedEntityList.size(); k++) { - TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = allTocofsSaleoutDetailedEntityList.get(k); - if (tocofsSaleoutDetailedEntity.getId().equals(detailsDto.getId())) { - newstate = tocofsSaleoutDetailedEntity.getNewstate(); - if (succeseeY.equals(newstate) || succeseeH.equals(newstate)) { - isSuccess = true; + if (allTocofsSaleoutDetailedEntityList != null && allTocofsSaleoutDetailedEntityList.size() > 0) { + for (int k = 0; k < allTocofsSaleoutDetailedEntityList.size(); k++) { + TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = allTocofsSaleoutDetailedEntityList.get(k); + if (tocofsSaleoutDetailedEntity.getId().equals(detailsDto.getId())) { + newstate = tocofsSaleoutDetailedEntity.getNewstate(); + if (succeseeY.equals(newstate) || succeseeH.equals(newstate)) { + isSuccess = true; + } } } } @@ -532,7 +534,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { */ private List filterDataRowsAsPushOrFailedTran(List allTocofsSaleoutDetailedEntityList, List headerDetailsDtoList) throws Exception { List targetHeaderDetailsDtoList = new ArrayList<>(); - if (allTocofsSaleoutDetailedEntityList != null && allTocofsSaleoutDetailedEntityList.size() > 0 && headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { + if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { //字段Y(成功)或者为H(待处理)可以视为成功,完成了小段业务闭环的数据行 String succeseeY = "Y"; String succeseeH = "H"; @@ -547,14 +549,16 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { Boolean isSuccess = false; String newstate4 = null; - for (int k = 0; k < allTocofsSaleoutDetailedEntityList.size(); k++) { - TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = allTocofsSaleoutDetailedEntityList.get(k); - if (tocofsSaleoutDetailedEntity.getId().equals(detailsDto.getId())) { - newstate4 = tocofsSaleoutDetailedEntity.getNewstate4(); - //验证交易成功(红)是否成功、(销售)交易成功(蓝)是否成功 两者如果都成功,则过滤掉,如果其中一个不能成功,则还是需要进行补推! - //验证红或蓝单据是否推送成功的代码,在implementTran中实现 - if ((succeseeY.equals(newstate4) || succeseeH.equals(newstate4))) { - isSuccess = true; + if (allTocofsSaleoutDetailedEntityList != null && allTocofsSaleoutDetailedEntityList.size() > 0) { + for (int k = 0; k < allTocofsSaleoutDetailedEntityList.size(); k++) { + TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = allTocofsSaleoutDetailedEntityList.get(k); + if (tocofsSaleoutDetailedEntity.getId().equals(detailsDto.getId())) { + newstate4 = tocofsSaleoutDetailedEntity.getNewstate4(); + //验证交易成功(红)是否成功、(销售)交易成功(蓝)是否成功 两者如果都成功,则过滤掉,如果其中一个不能成功,则还是需要进行补推! + //验证红或蓝单据是否推送成功的代码,在implementTran中实现 + if ((succeseeY.equals(newstate4) || succeseeH.equals(newstate4))) { + isSuccess = true; + } } } } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java index e317879b..29fe32b1 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java @@ -483,7 +483,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { */ private List filterDataRowsAsPushOrFailedStock(List allTocofsSaleoutDetailedEntityList, List headerDetailsDtoList) throws Exception { List targetHeaderDetailsDtoList = new ArrayList<>(); - if (allTocofsSaleoutDetailedEntityList != null && allTocofsSaleoutDetailedEntityList.size() > 0 && headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { + if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { //字段Y(成功)或者为H(待处理)可以视为成功,完成了小段业务闭环的数据行 String succeseeY = "Y"; String succeseeH = "H"; @@ -497,12 +497,14 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { DetailsDto detailsDto = details.get(j); Boolean isSuccess = false; String newstate = null; - for (int k = 0; k < allTocofsSaleoutDetailedEntityList.size(); k++) { - TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = allTocofsSaleoutDetailedEntityList.get(k); - if (tocofsSaleoutDetailedEntity.getId().equals(detailsDto.getId())) { - newstate = tocofsSaleoutDetailedEntity.getNewstate(); - if (succeseeY.equals(newstate) || succeseeH.equals(newstate)) { - isSuccess = true; + if (allTocofsSaleoutDetailedEntityList.size() > 0) { + for (int k = 0; k < allTocofsSaleoutDetailedEntityList.size(); k++) { + TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = allTocofsSaleoutDetailedEntityList.get(k); + if (tocofsSaleoutDetailedEntity.getId().equals(detailsDto.getId())) { + newstate = tocofsSaleoutDetailedEntity.getNewstate(); + if (succeseeY.equals(newstate) || succeseeH.equals(newstate)) { + isSuccess = true; + } } } } @@ -530,7 +532,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { */ private List filterDataRowsAsPushOrFailedTran(List allTocofsSaleoutDetailedEntityList, List headerDetailsDtoList) throws Exception { List targetHeaderDetailsDtoList = new ArrayList<>(); - if (allTocofsSaleoutDetailedEntityList != null && allTocofsSaleoutDetailedEntityList.size() > 0 && headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { + if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { //字段Y(成功)或者为H(待处理)可以视为成功,完成了小段业务闭环的数据行 String succeseeY = "Y"; String succeseeH = "H"; @@ -547,16 +549,18 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { String newstate2 = null; String newstate3 = null; // TocofsSaleoutDetailedEntity targetTocofsSaleoutDetailedEntity = null; - for (int k = 0; k < allTocofsSaleoutDetailedEntityList.size(); k++) { - TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = allTocofsSaleoutDetailedEntityList.get(k); - if (tocofsSaleoutDetailedEntity.getId().equals(detailsDto.getId())) { - newstate2 = tocofsSaleoutDetailedEntity.getNewstate2(); - newstate3 = tocofsSaleoutDetailedEntity.getNewstate3(); + if (allTocofsSaleoutDetailedEntityList != null && allTocofsSaleoutDetailedEntityList.size() > 0) { + for (int k = 0; k < allTocofsSaleoutDetailedEntityList.size(); k++) { + TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = allTocofsSaleoutDetailedEntityList.get(k); + if (tocofsSaleoutDetailedEntity.getId().equals(detailsDto.getId())) { + newstate2 = tocofsSaleoutDetailedEntity.getNewstate2(); + newstate3 = tocofsSaleoutDetailedEntity.getNewstate3(); // targetTocofsSaleoutDetailedEntity = tocofsSaleoutDetailedEntity; - //验证交易成功(红)是否成功、(销售)交易成功(蓝)是否成功 两者如果都成功,则过滤掉,如果其中一个不能成功,则还是需要进行补推! - //验证红或蓝单据是否推送成功的代码,在implementTran中实现 - if ((succeseeY.equals(newstate2) || succeseeH.equals(newstate2)) && (succeseeY.equals(newstate3) || succeseeH.equals(newstate3))) { - isSuccess = true; + //验证交易成功(红)是否成功、(销售)交易成功(蓝)是否成功 两者如果都成功,则过滤掉,如果其中一个不能成功,则还是需要进行补推! + //验证红或蓝单据是否推送成功的代码,在implementTran中实现 + if ((succeseeY.equals(newstate2) || succeseeH.equals(newstate2)) && (succeseeY.equals(newstate3) || succeseeH.equals(newstate3))) { + isSuccess = true; + } } } } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java index 00205755..020c8d2e 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java @@ -17,6 +17,7 @@ import com.hzya.frame.plugin.lets.ofs.dao.ITocofsReturngoodsDao; import com.hzya.frame.plugin.lets.ofs.dao.ITocofsReturngoodsDetailedDao; import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity; import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsEntity; +import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; import com.hzya.frame.plugin.lets.queryvo.ExtIntegrationTaskLivingDetailsQueryVo; import com.hzya.frame.plugin.lets.queryvo.StartAndEndVo; @@ -25,7 +26,7 @@ import com.hzya.frame.plugin.lets.u8cdto.*; import com.hzya.frame.plugin.lets.util.*; import com.hzya.frame.split.SplitListByCountUtil; import com.hzya.frame.ttxofs.dto.InterfaceParamDto; -import com.hzya.frame.ttxofs.dto.ofssalesordersearch.DetailsDto; +import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto; import com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto; import com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto; import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleOrderMessageDto; @@ -104,7 +105,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { if (ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) { //按单号 if (param != null && !"".equals(param)) { - startImplementByCode(param); + startImplementByCode(param, sceneType); } } else if (ProfilesActiveConstant.TYPE_TIME_FRAME.equals(requestJson.get("type"))) { //前台页面功能日期推送,或者接口调用也行 @@ -322,7 +323,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { * * @author liuyang */ - public void startImplementByCode(String code) { + public void startImplementByCode(String code, String sceneType) { long startMillis = System.currentTimeMillis(); String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 售后入库单号:{}", code); logger.info(threadNameStrStart); @@ -351,7 +352,11 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { - getSetStock(returnGoodHeaderDetailsDataDtoArrayList); + if (sceneType.equals("stock")) { + getSetStock(returnGoodHeaderDetailsDataDtoArrayList); + } else if (sceneType.equals("tran")) { + getSetTrade(returnGoodHeaderDetailsDataDtoArrayList); + } } else { logger.info("没有查询到任何数据!不需要同步"); } @@ -422,14 +427,14 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { /** * 筛选出未推送、或者失败的数据行,过滤库存同步业务 * - * @param tocofsReturngoodsDetailedEntityList 日志行状态 + * @param tocofsReturngoodsDetailedEntityList 日志行状态,可能为0 * @param returnGoodHeaderDetailsDataDtoArrayList 返回结果 * @author liuyang */ private List filterDataRowsAsPushOrFailedStock(List tocofsReturngoodsDetailedEntityList, List returnGoodHeaderDetailsDataDtoArrayList) throws Exception { List targetHeaderDetailsDtoList = new ArrayList<>(); - if (tocofsReturngoodsDetailedEntityList != null && tocofsReturngoodsDetailedEntityList.size() > 0 && returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { + if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { //字段Y(成功)或者为H(待处理)可以视为成功,完成了小段业务闭环的数据行 String succeseeY = "Y"; String succeseeH = "H"; @@ -443,12 +448,64 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j); Boolean isSuccess = false; String newstate = null; - for (int k = 0; k < tocofsReturngoodsDetailedEntityList.size(); k++) { - TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = tocofsReturngoodsDetailedEntityList.get(k); - if (tocofsReturngoodsDetailedEntity.getId().equals(stockinB.getId())) { - newstate = tocofsReturngoodsDetailedEntity.getNewstate2(); - if (succeseeY.equals(newstate) || succeseeH.equals(newstate)) { - isSuccess = true; + if (tocofsReturngoodsDetailedEntityList != null && tocofsReturngoodsDetailedEntityList.size() > 0) { + for (int k = 0; k < tocofsReturngoodsDetailedEntityList.size(); k++) { + TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = tocofsReturngoodsDetailedEntityList.get(k); + if (tocofsReturngoodsDetailedEntity.getId().equals(stockinB.getId())) { + newstate = tocofsReturngoodsDetailedEntity.getNewstate(); + if (succeseeY.equals(newstate) || succeseeH.equals(newstate)) { + isSuccess = true; + } + } + } + } + if (!isSuccess) { + stockinB.setNewstate(newstate); + targetDetails.add(stockinB); + } + } + if (targetDetails.size() > 0) { + //如果明细行中,还存在未推送或者失败的数据,则需要更新明细行 + stockinOrder.setDetails(targetDetails); + targetHeaderDetailsDtoList.add(stockinOrder); + } + } + } + return targetHeaderDetailsDtoList; + } + + /** + * 筛选出未推送、或者失败的数据行,过滤库存同步业务 + * + * @param tocofsReturngoodsDetailedEntityList 日志行状态 + * @param returnGoodHeaderDetailsDataDtoArrayList 返回结果 + * @author liuyang + */ + private List filterDataRowsAsPushOrFailedTran(List tocofsReturngoodsDetailedEntityList, List returnGoodHeaderDetailsDataDtoArrayList) throws Exception { + List targetHeaderDetailsDtoList = new ArrayList<>(); + + if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { + //字段Y(成功)或者为H(待处理)可以视为成功,完成了小段业务闭环的数据行 + String succeseeY = "Y"; + String succeseeH = "H"; + for (int i = 0; i < returnGoodHeaderDetailsDataDtoArrayList.size(); i++) { + StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoArrayList.get(i); + StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader(); + List details = stockinOrder.getDetails(); + + List targetDetails = new ArrayList<>(); + for (int j = 0; j < details.size(); j++) { + StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j); + Boolean isSuccess = false; + String newstate = null; + if (tocofsReturngoodsDetailedEntityList != null && tocofsReturngoodsDetailedEntityList.size() > 0) { + for (int k = 0; k < tocofsReturngoodsDetailedEntityList.size(); k++) { + TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = tocofsReturngoodsDetailedEntityList.get(k); + if (tocofsReturngoodsDetailedEntity.getId().equals(stockinB.getId())) { + newstate = tocofsReturngoodsDetailedEntity.getNewstate2(); + if (succeseeY.equals(newstate) || succeseeH.equals(newstate)) { + isSuccess = true; + } } } } @@ -528,7 +585,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { tocofsReturngoodsDetailedEntityList.addAll(tocofsReturngoodsDetailedEntities); } } - return filterDataRowsAsPushOrFailedStock(tocofsReturngoodsDetailedEntityList, returnGoodHeaderDetailsDataDtoArrayList); + return filterDataRowsAsPushOrFailedTran(tocofsReturngoodsDetailedEntityList, returnGoodHeaderDetailsDataDtoArrayList); } /** @@ -594,6 +651,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { try { // 查询基本档案 +// String sceneType = "stock"; List orderToBHeaderDtos = queryBasicArchivesStock(returnGoodHeaderDetailsDataDtoList); // 查询U8C业务流程 BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(); @@ -819,18 +877,20 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { * * @author liuyang */ - private List queryBasicArchivesStock(List returnGoodHeaderDetailsDataDtoList) { + private List queryBasicArchivesStock(List returnGoodHeaderDetailsDataDtoList) throws Exception { if (returnGoodHeaderDetailsDataDtoList != null) { logger.info("库存同步:需要把OFS档案转换为U8C档案的O数据条数:{}", returnGoodHeaderDetailsDataDtoList.size()); } List orderToBHeaderDtoArrayList = new ArrayList<>(); - if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { - try { - for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) { - StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList.get(i); - StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader(); - List details = stockinOrder.getDetails(); + List errorHeaderDetailsDtoDtoList = new ArrayList<>(); + if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { + for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) { + StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList.get(i); + StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader(); + List details = stockinOrder.getDetails(); + + try { //查询售后订单 RerturnGoodsOrderSearchData ofsRertunOrder = afterSalesOrderUtil.getOfsRertunOrder(header.getRefOrderCode()); Assert.notNull(ofsRertunOrder, "无法查询到OFS售后订单 编码:{}", header.getRefOrderCode()); @@ -849,6 +909,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { } HeaderDto header1 = saleOrderMessageDto.getData().get(0).getHeader(); String memberId = header1.getMemberId(); + //TODO 会员id + memberId = "GYS00002"; Assert.notNull(memberId, "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!"); Assert.state(!"".equals(memberId.trim()), "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!"); @@ -861,6 +923,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { // 销售公司、发货公司 String companyCode = header.getCompanyCode(); + //TODO 测试 + companyCode = "SHLZ"; Assert.notNull(companyCode, "O表头公司不能为空"); BdCorpEntity bdCorpEntity = new BdCorpEntity(); bdCorpEntity.setDr(0); @@ -954,7 +1018,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { } //查找平台 - String platformZdyId = "0001A210000000000JUD"; +// String platformZdyId = "0001A210000000000JUD"; + String platformZdyId = OverallConstant.getOverAllValue("u8c自定义项档案-平台主键"); String sourcePlatformCode = header.getSourcePlatformCode(); BdDefdocEntity bdDefdocEntity = new BdDefdocEntity(); bdDefdocEntity.setPkDefdoclist(platformZdyId); @@ -969,7 +1034,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { } //查询U8C店铺档案 - String platformZdyId2 = "0001A210000000000XZX"; +// String platformZdyId2 = "0001A210000000000XZX"; + String platformZdyId2 = OverallConstant.getOverAllValue("u8c自定义项档案-店铺主键"); String ofsStoreCode = header.getStoreCode(); BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity(); bdDefdocEntity2.setPkDefdoclist(platformZdyId2); @@ -1002,21 +1068,37 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { orderOutTobHeaderDto.setDetails(details); orderToBHeaderDtoArrayList.add(orderOutTobHeaderDto); + } catch (Exception e) { + logger.error("档案转换失败", e); + + //失败 + String message = e.getMessage(); + if (message == null) { + message = "未知错误"; + } + ErrorHeaderDetailsDtoDtoV2 errorHeaderDetailsDtoDto = new ErrorHeaderDetailsDtoDtoV2(); + errorHeaderDetailsDtoDto.setNewPushDate(getNewDateStr()); + errorHeaderDetailsDtoDto.setNewTransmitInfo(message); + errorHeaderDetailsDtoDto.setNewstate("N"); + errorHeaderDetailsDtoDto.setHeader(header); + errorHeaderDetailsDtoDto.setDetails(details); + errorHeaderDetailsDtoDtoList.add(errorHeaderDetailsDtoDto); } - //成功 - } catch (Exception e) { - logger.error("OFS销售出库单关联查询U8C档案失败", e); - //失败 } + //成功 } else { logger.info("queryBasicArchives方法对应的returnGoodHeaderDetailsDataDtoList.size为0"); } + if (errorHeaderDetailsDtoDtoList.size() > 0) { + updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiryStock(errorHeaderDetailsDtoDtoList); + } return orderToBHeaderDtoArrayList; } /** * 交易成功档案查询,档案转换 * + * @param returnGoodHeaderDetailsDataDtoList 查询出来的售后入库单数据 * @author liuyang */ private List queryBasicArchivesTran(List returnGoodHeaderDetailsDataDtoList) { @@ -1024,13 +1106,15 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { logger.info("确认收入:需要把OFS档案转换为U8C档案的O数据条数:{}", returnGoodHeaderDetailsDataDtoList.size()); } List orderToBHeaderDtoArrayList = new ArrayList<>(); - if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { - try { - for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) { - StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList.get(i); - StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader(); - List details = stockinOrder.getDetails(); + List errorHeaderDetailsDtoDtoList = new ArrayList<>(); + if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { + for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) { + StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList.get(i); + StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader(); + List details = stockinOrder.getDetails(); + + try { //查询OFS售后订单 RerturnGoodsOrderSearchData ofsRertunOrder = afterSalesOrderUtil.getOfsRertunOrder(header.getRefOrderCode()); Assert.notNull(ofsRertunOrder, "无法查询到OFS售后订单 编码:{}", header.getRefOrderCode()); @@ -1049,6 +1133,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { } HeaderDto header1 = saleOrderMessageDto.getData().get(0).getHeader(); String memberId = header1.getMemberId(); + //TODO 测试 + memberId = "GYS00002"; Assert.notNull(memberId, "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!"); Assert.state(!"".equals(memberId.trim()), "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!"); @@ -1117,6 +1203,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { // 销售公司、发货公司 String companyCode = header.getCompanyCode(); + //TODO 测试 + companyCode = "SHLZ"; Assert.notNull(companyCode, "O表头公司不能为空"); BdCorpEntity bdCorpEntity = new BdCorpEntity(); bdCorpEntity.setDr(0); @@ -1209,7 +1297,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { } //查找平台 - String platformZdyId = "0001A210000000000JUD"; +// String platformZdyId = "0001A210000000000JUD"; + String platformZdyId = OverallConstant.getOverAllValue("u8c自定义项档案-平台主键"); String sourcePlatformCode = header.getSourcePlatformCode(); BdDefdocEntity bdDefdocEntity = new BdDefdocEntity(); bdDefdocEntity.setPkDefdoclist(platformZdyId); @@ -1224,7 +1313,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { } //查询U8C店铺档案 - String platformZdyId2 = "0001A210000000000XZX"; +// String platformZdyId2 = "0001A210000000000XZX"; + String platformZdyId2 = OverallConstant.getOverAllValue("u8c自定义项档案-店铺主键"); String ofsStoreCode = header.getStoreCode(); BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity(); bdDefdocEntity2.setPkDefdoclist(platformZdyId2); @@ -1276,15 +1366,29 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { BeanUtil.copyPropertiesV2(header, orderOutTobHeaderDto); orderToBHeaderDtoArrayList.add(orderOutTobHeaderDto); + } catch (Exception e) { + logger.error("TOB退货确认收入", e); + + //失败 + String message = e.getMessage(); + if (message == null) { + message = "未知错误"; + } + ErrorHeaderDetailsDtoDtoV2 errorHeaderDetailsDtoDto = new ErrorHeaderDetailsDtoDtoV2(); + errorHeaderDetailsDtoDto.setNewPushDate2(getNewDateStr()); + errorHeaderDetailsDtoDto.setNewTransmitInfo2(message); + errorHeaderDetailsDtoDto.setNewstate2("N"); + errorHeaderDetailsDtoDto.setHeader(header); + errorHeaderDetailsDtoDto.setDetails(details); + errorHeaderDetailsDtoDtoList.add(errorHeaderDetailsDtoDto); } - //成功,记录到日志表 - } catch (Exception e) { - logger.error("OFS销售出库单关联查询U8C档案失败", e); - //失败,记录到日志表 } } else { logger.info("queryBasicArchives方法对应的returnGoodHeaderDetailsDataDtoList.size为0"); } + if (errorHeaderDetailsDtoDtoList.size() > 0) { + updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiryTran(errorHeaderDetailsDtoDtoList); + } return orderToBHeaderDtoArrayList; } @@ -1323,9 +1427,9 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = new TocofsReturngoodsDetailedEntity(); // tocofsReturngoodsDetailedEntity.setBusinessType("TOB_RETURN"); - BeanUtil.copyPropertiesV2(returnGoodSearchHeaderDto, tocofsReturngoodsDetailedEntity); + //处理填充额外字段 + BeanUtil.copyPropertiesV2(stockinB, tocofsReturngoodsDetailedEntity); createPrimaryKeyAndBusinessDateAndBusinessType(tocofsReturngoodsDetailedEntity, returnGoodSearchHeaderDto); - tocofsSaleoutDetailedEntityArrayList.add(tocofsReturngoodsDetailedEntity); } } else { @@ -1502,8 +1606,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { private void createPrimaryKeyAndBusinessDateAndBusinessType(TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity, StockinOrderSearchResponse.StockinOrder.StockinH returnGoodSearchHeaderDto) { if (tocofsReturngoodsDetailedEntity != null && returnGoodSearchHeaderDto != null) { //主表主键 - if (tocofsReturngoodsDetailedEntity.getId() != null) { - tocofsReturngoodsDetailedEntity.setMaintableid(tocofsReturngoodsDetailedEntity.getId()); + if (returnGoodSearchHeaderDto.getId() != null) { + tocofsReturngoodsDetailedEntity.setMaintableid(returnGoodSearchHeaderDto.getId()); } //业务日期-入库时间 if (returnGoodSearchHeaderDto.getCheckInFrom() != null) { @@ -1531,6 +1635,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { try { //转换基本档案 +// String sceneType = "tran"; List orderToBHeaderDtos = queryBasicArchivesTran(returnGoodHeaderDetailsDataDtoList); //查询U8C业务流程 BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(); @@ -2151,4 +2256,135 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { logger.error("updateSuccessOrFail2方法现场抛出异常", e); } } + + /** + * 批量修改成功、或者失败,适合档案查询的部分 + * + * @author liuyang + */ + private void updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiryStock(List errorHeaderDetailsDtoDtoList) throws Exception { + Assert.notNull(errorHeaderDetailsDtoDtoList, "errorHeaderDetailsDtoDtoList不能为空!"); + + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + try { + if (errorHeaderDetailsDtoDtoList != null && errorHeaderDetailsDtoDtoList.size() > 0) { + List tocofsReturngoodsDetailedEntityList = new ArrayList<>(); + for (int i = 0; i < errorHeaderDetailsDtoDtoList.size(); i++) { + ErrorHeaderDetailsDtoDtoV2 errorHeaderDetailsDtoDtoV2 = errorHeaderDetailsDtoDtoList.get(i); + StockinOrderSearchResponse.StockinOrder.StockinH header = errorHeaderDetailsDtoDtoV2.getHeader(); + List details = errorHeaderDetailsDtoDtoV2.getDetails(); + + String newstate = errorHeaderDetailsDtoDtoV2.getNewstate(); + String newPushDate = errorHeaderDetailsDtoDtoV2.getNewPushDate(); + String newTransmitInfo = errorHeaderDetailsDtoDtoV2.getNewTransmitInfo(); + + //如果报错内容太长了,则仅保留500个长度 + if (newTransmitInfo != null && !"".equals(newTransmitInfo.trim()) && newTransmitInfo.length() >= 400) { + newTransmitInfo = newTransmitInfo.substring(0, 400); + } + + for (int j = 0; j < details.size(); j++) { + StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j); + + TocofsReturngoodsDetailedEntity tocofsSaleoutDetailedEntity = new TocofsReturngoodsDetailedEntity(); + tocofsSaleoutDetailedEntity.setId(stockinB.getId()); + tocofsSaleoutDetailedEntity.setNewpushdate(newPushDate); + tocofsSaleoutDetailedEntity.setNewtransmitinfo(newTransmitInfo); + tocofsSaleoutDetailedEntity.setNewstate(newstate); + tocofsSaleoutDetailedEntity.setNewsystemnumber(null); + tocofsSaleoutDetailedEntity.setNewsystemprimary(null); + tocofsReturngoodsDetailedEntityList.add(tocofsSaleoutDetailedEntity); + } + } + + //以50行为一个批次更新状态 + if (tocofsReturngoodsDetailedEntityList.size() > 0) { + List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsReturngoodsDetailedEntityList, 50); + for (int i = 0; i < splitListByCount.size(); i++) { + List tocofsReturngoodsDetailedEntityList1 = splitListByCount.get(i); + iTocofsReturngoodsDetailedDao.entityInsertOrUpdateBatchByTobRerturnStockV2(tocofsReturngoodsDetailedEntityList1); + } + } + } + } catch (Exception e) { + logger.error("TOB填充出库明细日志抛出异常", e); + } + } + }); + thread.start(); + try { + thread.join(); + } catch (Exception e) { + logger.error("updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiry方法现场抛出异常", e); + } + } + + + /** + * 批量修改成功、或者失败,适合档案查询的部分 + * + * @author liuyang + */ + private void updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiryTran(List errorHeaderDetailsDtoDtoList) { + Assert.notNull(errorHeaderDetailsDtoDtoList, "errorHeaderDetailsDtoDtoList不能为空!"); + + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + try { + if (errorHeaderDetailsDtoDtoList != null && errorHeaderDetailsDtoDtoList.size() > 0) { + List tocofsReturngoodsDetailedEntityList = new ArrayList<>(); + for (int i = 0; i < errorHeaderDetailsDtoDtoList.size(); i++) { + ErrorHeaderDetailsDtoDtoV2 errorHeaderDetailsDtoDtoV2 = errorHeaderDetailsDtoDtoList.get(i); + StockinOrderSearchResponse.StockinOrder.StockinH header = errorHeaderDetailsDtoDtoV2.getHeader(); + List details = errorHeaderDetailsDtoDtoV2.getDetails(); + + String newstate = errorHeaderDetailsDtoDtoV2.getNewstate2(); + String newPushDate = errorHeaderDetailsDtoDtoV2.getNewPushDate2(); + String newTransmitInfo = errorHeaderDetailsDtoDtoV2.getNewTransmitInfo2(); + + //如果报错内容太长了,则仅保留500个长度 + if (newTransmitInfo != null && !"".equals(newTransmitInfo.trim()) && newTransmitInfo.length() >= 400) { + newTransmitInfo = newTransmitInfo.substring(0, 400); + } + + for (int j = 0; j < details.size(); j++) { + StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j); + + TocofsReturngoodsDetailedEntity tocofsSaleoutDetailedEntity = new TocofsReturngoodsDetailedEntity(); + tocofsSaleoutDetailedEntity.setId(stockinB.getId()); + tocofsSaleoutDetailedEntity.setNewpushdate2(newPushDate); + tocofsSaleoutDetailedEntity.setNewtransmitinfo2(newTransmitInfo); + tocofsSaleoutDetailedEntity.setNewstate2(newstate); + tocofsSaleoutDetailedEntity.setNewsystemnumber2(null); + tocofsSaleoutDetailedEntity.setNewsystemprimary2(null); + tocofsReturngoodsDetailedEntityList.add(tocofsSaleoutDetailedEntity); + } + } + + //以50行为一个批次更新状态 + if (tocofsReturngoodsDetailedEntityList.size() > 0) { + List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsReturngoodsDetailedEntityList, 50); + for (int i = 0; i < splitListByCount.size(); i++) { + List tocofsReturngoodsDetailedEntityList1 = splitListByCount.get(i); + iTocofsReturngoodsDetailedDao.entityInsertOrUpdateBatchByTobRerturnTranV2(tocofsReturngoodsDetailedEntityList1); + } + } + } + } catch (Exception e) { + logger.error("TOB填充出库明细日志抛出异常", e); + } + } + }); + thread.start(); + try { + thread.join(); + } catch (Exception e) { + logger.error("updateFailOrSuccessTocofsSaleoutDetailedArchiveInquiry方法现场抛出异常", e); + } + } + + } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java index b1e58569..5ee97c2d 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java @@ -1445,8 +1445,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { private void createPrimaryKeyAndBusinessDateAndBusinessType(TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity, StockinOrderSearchResponse.StockinOrder.StockinH returnGoodSearchHeaderDto) { if (tocofsReturngoodsDetailedEntity != null && returnGoodSearchHeaderDto != null) { //主表主键 - if (tocofsReturngoodsDetailedEntity.getId() != null) { - tocofsReturngoodsDetailedEntity.setMaintableid(tocofsReturngoodsDetailedEntity.getId()); + if (returnGoodSearchHeaderDto.getId() != null) { + tocofsReturngoodsDetailedEntity.setMaintableid(returnGoodSearchHeaderDto.getId()); } //业务日期-入库时间 if (returnGoodSearchHeaderDto.getCheckInFrom() != null) { @@ -1877,7 +1877,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { private List filterDataRowsAsPushOrFailedStock(List tocofsReturngoodsDetailedEntityList, List returnGoodHeaderDetailsDataDtoArrayList) throws Exception { List targetHeaderDetailsDtoList = new ArrayList<>(); - if (tocofsReturngoodsDetailedEntityList != null && tocofsReturngoodsDetailedEntityList.size() > 0 && returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { + if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { //字段Y(成功)或者为H(待处理)可以视为成功,完成了小段业务闭环的数据行 String succeseeY = "Y"; String succeseeH = "H"; @@ -1891,12 +1891,14 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j); Boolean isSuccess = false; String newstate = null; - for (int k = 0; k < tocofsReturngoodsDetailedEntityList.size(); k++) { - TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = tocofsReturngoodsDetailedEntityList.get(k); - if (tocofsReturngoodsDetailedEntity.getId().equals(stockinB.getId())) { - newstate = tocofsReturngoodsDetailedEntity.getNewstate3(); - if (succeseeY.equals(newstate) || succeseeH.equals(newstate)) { - isSuccess = true; + if (tocofsReturngoodsDetailedEntityList != null && tocofsReturngoodsDetailedEntityList.size() > 0) { + for (int k = 0; k < tocofsReturngoodsDetailedEntityList.size(); k++) { + TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = tocofsReturngoodsDetailedEntityList.get(k); + if (tocofsReturngoodsDetailedEntity.getId().equals(stockinB.getId())) { + newstate = tocofsReturngoodsDetailedEntity.getNewstate3(); + if (succeseeY.equals(newstate) || succeseeH.equals(newstate)) { + isSuccess = true; + } } } } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ErrorHeaderDetailsDtoDtoV2.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ErrorHeaderDetailsDtoDtoV2.java index db38ca2c..8d608b67 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ErrorHeaderDetailsDtoDtoV2.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ErrorHeaderDetailsDtoDtoV2.java @@ -30,4 +30,10 @@ public class ErrorHeaderDetailsDtoDtoV2 extends StockinOrderSearchResponse.Stock private String newSystemNumber4; //下游主键 private String newSystemPrimary4; + //(销售)推送时间 + private String newPushDate2; + //(销售)报错详情 + private String newTransmitInfo2; + //(销售)出库同步是否成功 + private String newstate2; } diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToBTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToBTest.java index 1714ff3b..e7389f77 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToBTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToBTest.java @@ -36,7 +36,7 @@ public class SoSaleReturnPluginInitializerToBTest { // soSaleReturnPluginInitializerToB.startImplementByTradeTime("2024-08-30 15:54:41", "2024-08-30 15:54:43"); - soSaleReturnPluginInitializerToB.startImplementByCode("LETS-RE2024091400000001"); + soSaleReturnPluginInitializerToB.startImplementByCode("LETS-RE2024091400000001", "tran"); } catch (Exception e) { e.printStackTrace(); }