feat(plugin): 添加销售出库和售后入库单号打印功能

- 在 SoSaleOutPluginInitializerToB 和 SoSaleReturnPluginInitializerToB 类中添加了 splicingPrintingOrderNumber 方法
- 该方法用于打印销售出库和售后入库单号
- 在查询库存和确认收入时调用该方法记录日志
- 优化了测试用例,注释掉了部分测试代码
This commit is contained in:
liuy 2024-11-11 16:42:03 +08:00
parent 194afebd4a
commit 9dc6100538
5 changed files with 55 additions and 8 deletions

View File

@ -34,6 +34,7 @@ import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import sun.tools.jinfo.JInfo;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
@ -269,6 +270,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
// queryOfsSoSaleOutVo.setCode("LETS-SH2024010200000004"); // queryOfsSoSaleOutVo.setCode("LETS-SH2024010200000004");
ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search");
logger.info("插件:{} (库存)O接口返回行数{} 时间段:{} {}", getPluginName(), headerDetailsDtoList.size(), startTime, endTime); logger.info("插件:{} (库存)O接口返回行数{} 时间段:{} {}", getPluginName(), headerDetailsDtoList.size(), startTime, endTime);
splicingPrintingOrderNumber(headerDetailsDtoList, "stock", startTime, endTime, null);
if (headerDetailsDtoList.size() > 0) { if (headerDetailsDtoList.size() > 0) {
getSetStock(headerDetailsDtoList); getSetStock(headerDetailsDtoList);
} else { } else {
@ -314,6 +316,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
queryOfsSoSaleOutVo.setStoreCode(tobShop); queryOfsSoSaleOutVo.setStoreCode(tobShop);
ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search");
logger.info("插件:{} (确认收入)O接口返回行数{} 时间段:{} {}", getPluginName(), headerDetailsDtoList.size(), startTime, endTime); logger.info("插件:{} (确认收入)O接口返回行数{} 时间段:{} {}", getPluginName(), headerDetailsDtoList.size(), startTime, endTime);
splicingPrintingOrderNumber(headerDetailsDtoList, "tran", startTime, endTime, null);
if (headerDetailsDtoList.size() > 0) { if (headerDetailsDtoList.size() > 0) {
getSetStockTran(headerDetailsDtoList); getSetStockTran(headerDetailsDtoList);
} else { } else {
@ -355,6 +358,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
queryOfsSoSaleOutVo.setCode(code); queryOfsSoSaleOutVo.setCode(code);
ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search");
logger.info("根据单据号查询:数据返回行数:{}", headerDetailsDtoList.size()); logger.info("根据单据号查询:数据返回行数:{}", headerDetailsDtoList.size());
splicingPrintingOrderNumber(headerDetailsDtoList, sceneType, null, null, code);
if (headerDetailsDtoList.size() > 0) { if (headerDetailsDtoList.size() > 0) {
if (sceneType.equals("stock")) { if (sceneType.equals("stock")) {
getSetStock(headerDetailsDtoList); getSetStock(headerDetailsDtoList);
@ -2716,4 +2720,22 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
// } // }
// } // }
// } // }
/**
* 打印出库单单号
*
* @author liuyang
*/
private void splicingPrintingOrderNumber(List<HeaderDetailsDto> headerDetailsDtoList, String sceneType, String startTime, String endTime, String code) {
try {
if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) {
String codesJoined = headerDetailsDtoList.stream().map(HeaderDetailsDto::getHeader).map(HeaderDto::getCode).collect(Collectors.joining(","));
logger.info("{} 销售出库单号:{} 查询条件:{} {} code{}", sceneType, codesJoined, startTime, endTime, code);
} else {
logger.info("{} 销售出库单号:{} 查询条件:{} {} code{}", sceneType, "", startTime, endTime, code);
}
} catch (Exception e) {
logger.error("splicingPrintingOrderNumber方法抛出异常", e);
}
}
} }

View File

@ -270,6 +270,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
// queryOfsSoSaleOutVo.setCode("LETS-RE2024081900000001"); // queryOfsSoSaleOutVo.setCode("LETS-RE2024081900000001");
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search");
logger.info("插件:{} (库存)O接口返回行数{} 时间段:{} {}", getPluginName(), returnGoodHeaderDetailsDataDtoArrayList.size(), startTime, endTime); logger.info("插件:{} (库存)O接口返回行数{} 时间段:{} {}", getPluginName(), returnGoodHeaderDetailsDataDtoArrayList.size(), startTime, endTime);
splicingPrintingOrderNumber(returnGoodHeaderDetailsDataDtoArrayList, "stock", startTime, endTime, null);
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
getSetStock(returnGoodHeaderDetailsDataDtoArrayList); getSetStock(returnGoodHeaderDetailsDataDtoArrayList);
} else { } else {
@ -317,6 +318,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
// queryOfsSoSaleOutVo.setCode("LETS-RE2024081900000001"); // queryOfsSoSaleOutVo.setCode("LETS-RE2024081900000001");
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search");
logger.info("插件:{} (确认收入)O接口返回行数{} 时间段:{} {}", getPluginName(), returnGoodHeaderDetailsDataDtoArrayList.size(), startTime, endTime); logger.info("插件:{} (确认收入)O接口返回行数{} 时间段:{} {}", getPluginName(), returnGoodHeaderDetailsDataDtoArrayList.size(), startTime, endTime);
splicingPrintingOrderNumber(returnGoodHeaderDetailsDataDtoArrayList, "tran", startTime, endTime, null);
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
getSetTrade(returnGoodHeaderDetailsDataDtoArrayList); getSetTrade(returnGoodHeaderDetailsDataDtoArrayList);
} else { } else {
@ -361,6 +363,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
// queryOfsSoSaleOutVo.setStatus(900L); // queryOfsSoSaleOutVo.setStatus(900L);
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search");
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
splicingPrintingOrderNumber(returnGoodHeaderDetailsDataDtoArrayList, sceneType, null, null, code);
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
if (sceneType.equals("stock")) { if (sceneType.equals("stock")) {
getSetStock(returnGoodHeaderDetailsDataDtoArrayList); getSetStock(returnGoodHeaderDetailsDataDtoArrayList);
@ -2569,4 +2572,22 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
} }
return totalPayAmount; return totalPayAmount;
} }
/**
* 打印售后入库单单号
*
* @author liuyang
*/
private void splicingPrintingOrderNumber(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList, String sceneType, String startTime, String endTime, String code) {
try {
if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
String codesJoined = returnGoodHeaderDetailsDataDtoArrayList.stream().map(StockinOrderSearchResponse.StockinOrder::getHeader).map(StockinOrderSearchResponse.StockinOrder.StockinH::getCode).collect(Collectors.joining(","));
logger.info("{} 售后入库单单号:{} 查询条件:{} {} code{}", sceneType, codesJoined, startTime, endTime, code);
} else {
logger.info("{} 售后入库单单号:{} 查询条件:{} {} code{}", sceneType, "", startTime, endTime, code);
}
} catch (Exception e) {
logger.error("splicingPrintingOrderNumber方法抛出异常", e);
}
}
} }

View File

@ -79,7 +79,8 @@ public class SoSaleOutPluginInitializerToBTest {
// soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024101700000270"); // soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024101700000270");
try { try {
// soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024102300053750", "tran"); // soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024110700023341", "stock");
// soSaleOutPluginInitializerToB.startImplementByStockTime("2024-10-23 16:09:59", "2024-10-23 16:10:01"); // soSaleOutPluginInitializerToB.startImplementByStockTime("2024-10-23 16:09:59", "2024-10-23 16:10:01");
// String aaa = "LETS-SH2024103100016169"; // String aaa = "LETS-SH2024103100016169";
@ -88,10 +89,13 @@ public class SoSaleOutPluginInitializerToBTest {
// soSaleOutPluginInitializerToB.startImplementByStockTime("2024-10-31 14:48:41", "2024-10-31 14:48:41"); // soSaleOutPluginInitializerToB.startImplementByStockTime("2024-10-31 14:48:41", "2024-10-31 14:48:41");
// soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024110700026623", "stock"); // soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024110700026623", "tran");
soSaleOutPluginInitializerToB.startImplementByStockTime("2024-11-07 00:00:00", "2024-11-07 23:59:59"); // soSaleOutPluginInitializerToB.startImplementByStockTime("2024-11-08 19:18:02", "2024-11-08 19:18:02");
soSaleOutPluginInitializerToB.startImplementByTranTime("2000-11-08 19:18:02", "2000-11-08 19:18:02");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -112,7 +112,7 @@ class SoSaleOutPluginInitializerToCTest {
// String aaa = "LETS-SH2024102900016893"; // String aaa = "LETS-SH2024102900016893";
// soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran"); // soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran");
soSaleOutPluginInitializerToC.startImplementTranByTime("2024-11-05 09:40:20", "2024-11-05 09:40:20"); // soSaleOutPluginInitializerToC.startImplementTranByTime("2024-11-05 09:40:20", "2024-11-05 09:40:20");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -121,7 +121,7 @@ class SoSaleOutPluginInitializerToCTest {
try { try {
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024091900002878", "stock"); // soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024091900002878", "stock");
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024110500029917", "tran"); soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024110500013375", "tran");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -30,8 +30,8 @@ public class SoSaleReturnPluginInitializerToCTest {
public void startImplement() { public void startImplement() {
// soSaleReturnPluginInitializerToC.startImplement(null, null); // soSaleReturnPluginInitializerToC.startImplement(null, null);
try { try {
String code = "LETS-RE2024110500004678"; // String code = "LETS-RE2024110500004678";
soSaleReturnPluginInitializerToC.startImplementByCode(code, "stock"); // soSaleReturnPluginInitializerToC.startImplementByCode(code, "stock");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -41,7 +41,7 @@ public class SoSaleReturnPluginInitializerToCTest {
try { try {
// soSaleReturnPluginInitializerToC.startImplementStockByTime("2024-10-21 00:00:00", "2024-10-21 23:59:59"); soSaleReturnPluginInitializerToC.startImplementStockByTime("2024-11-01 00:00:00", "2024-11-01 23:59:59");
// JSONObject jsonObject = new JSONObject(); // JSONObject jsonObject = new JSONObject();
// soSaleReturnPluginInitializerToC.executeBusiness(jsonObject); // soSaleReturnPluginInitializerToC.executeBusiness(jsonObject);