refactor(purchase): 重构业务日期生成逻辑

- 修改了 ConsignmachiningIn 和 ProxyPurchaseWarehousWarehouse 类中的 createGenerateBusinessDate 方法
- 将 checkInFrom 或 checkInTo 字段替换为 closedAt 字段
-优化了日期解析和格式化的代码结构
- 更新了相关测试用例中的输入参数
This commit is contained in:
liuy 2025-01-13 18:19:31 +08:00
parent e6e7a145bc
commit 19f01080a6
4 changed files with 9 additions and 9 deletions

View File

@ -815,12 +815,12 @@ public class ConsignmachiningIn extends PluginBaseEntity {
* @author liuyang
*/
private String createGenerateBusinessDate(ConsignmachiningInSonDto consignmachiningInSonDto) {
if (consignmachiningInSonDto != null && consignmachiningInSonDto.getCheckInFrom() != null) {
String checkInFrom = consignmachiningInSonDto.getCheckInFrom();
if (consignmachiningInSonDto != null && consignmachiningInSonDto.getClosedAt() != null) {
String closedAt = consignmachiningInSonDto.getClosedAt();
String businessFormat = null;
try {
Date dbill = DateUtil.parse(checkInFrom);
Date dbill = DateUtil.parse(closedAt);
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
} catch (Exception e) {
logger.error("业务日期生成失败", e);

View File

@ -848,10 +848,10 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
*/
private String createGenerateBusinessDate(PoOrderSonDto poOrderSonDto) {
if (poOrderSonDto != null && poOrderSonDto.getClosedAt() != null) {
String checkInTo = poOrderSonDto.getClosedAt();
String closedAt = poOrderSonDto.getClosedAt();
String businessFormat = null;
try {
Date dbill = DateUtil.parse(checkInTo);
Date dbill = DateUtil.parse(closedAt);
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
} catch (Exception e) {
logger.error("业务日期生成失败", e);
@ -873,10 +873,10 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
private String createGenerateBusinessDate(StockinOrderSearchResponse.StockinOrder stockinOrder) {
if (stockinOrder != null) {
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
String checkInFrom = header.getCheckInFrom();
String closedAt = header.getClosedAt();
String businessFormat = null;
try {
Date dbill = DateUtil.parse(checkInFrom);
Date dbill = DateUtil.parse(closedAt);
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
} catch (Exception e) {
logger.error("业务日期生成失败", e);

View File

@ -25,7 +25,7 @@ public class ProxyPurchaseReturnTest {
@Test
public void startImplement() {
try {
proxyPurchaseReturn.startImplement("LETS-SH2025010600023310");
proxyPurchaseReturn.startImplement("LETS-SH2025010700024055");
// proxyPurchaseReturn.startImplement("2024-01-01 00:00:00", "2024-08-07 23:59:59");

View File

@ -26,6 +26,6 @@ public class ProxyPurchaseWarehousWarehouseTest {
@Test
public void startImplementByCode() {
proxyPurchaseWarehousWarehouse.startImplementByCode("LETS-RE2024110500014600");
proxyPurchaseWarehousWarehouse.startImplementByCode("LETS-RE2024120300000525");
}
}