refactor(purchase): 重构业务日期生成逻辑
- 修改了 ConsignmachiningIn 和 ProxyPurchaseWarehousWarehouse 类中的 createGenerateBusinessDate 方法 - 将 checkInFrom 或 checkInTo 字段替换为 closedAt 字段 -优化了日期解析和格式化的代码结构 - 更新了相关测试用例中的输入参数
This commit is contained in:
parent
e6e7a145bc
commit
19f01080a6
|
@ -815,12 +815,12 @@ public class ConsignmachiningIn extends PluginBaseEntity {
|
||||||
* @author liuyang
|
* @author liuyang
|
||||||
*/
|
*/
|
||||||
private String createGenerateBusinessDate(ConsignmachiningInSonDto consignmachiningInSonDto) {
|
private String createGenerateBusinessDate(ConsignmachiningInSonDto consignmachiningInSonDto) {
|
||||||
if (consignmachiningInSonDto != null && consignmachiningInSonDto.getCheckInFrom() != null) {
|
if (consignmachiningInSonDto != null && consignmachiningInSonDto.getClosedAt() != null) {
|
||||||
String checkInFrom = consignmachiningInSonDto.getCheckInFrom();
|
String closedAt = consignmachiningInSonDto.getClosedAt();
|
||||||
|
|
||||||
String businessFormat = null;
|
String businessFormat = null;
|
||||||
try {
|
try {
|
||||||
Date dbill = DateUtil.parse(checkInFrom);
|
Date dbill = DateUtil.parse(closedAt);
|
||||||
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
|
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("业务日期生成失败", e);
|
logger.error("业务日期生成失败", e);
|
||||||
|
|
|
@ -848,10 +848,10 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
|
||||||
*/
|
*/
|
||||||
private String createGenerateBusinessDate(PoOrderSonDto poOrderSonDto) {
|
private String createGenerateBusinessDate(PoOrderSonDto poOrderSonDto) {
|
||||||
if (poOrderSonDto != null && poOrderSonDto.getClosedAt() != null) {
|
if (poOrderSonDto != null && poOrderSonDto.getClosedAt() != null) {
|
||||||
String checkInTo = poOrderSonDto.getClosedAt();
|
String closedAt = poOrderSonDto.getClosedAt();
|
||||||
String businessFormat = null;
|
String businessFormat = null;
|
||||||
try {
|
try {
|
||||||
Date dbill = DateUtil.parse(checkInTo);
|
Date dbill = DateUtil.parse(closedAt);
|
||||||
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
|
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("业务日期生成失败", e);
|
logger.error("业务日期生成失败", e);
|
||||||
|
@ -873,10 +873,10 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
|
||||||
private String createGenerateBusinessDate(StockinOrderSearchResponse.StockinOrder stockinOrder) {
|
private String createGenerateBusinessDate(StockinOrderSearchResponse.StockinOrder stockinOrder) {
|
||||||
if (stockinOrder != null) {
|
if (stockinOrder != null) {
|
||||||
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
|
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
|
||||||
String checkInFrom = header.getCheckInFrom();
|
String closedAt = header.getClosedAt();
|
||||||
String businessFormat = null;
|
String businessFormat = null;
|
||||||
try {
|
try {
|
||||||
Date dbill = DateUtil.parse(checkInFrom);
|
Date dbill = DateUtil.parse(closedAt);
|
||||||
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
|
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("业务日期生成失败", e);
|
logger.error("业务日期生成失败", e);
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class ProxyPurchaseReturnTest {
|
||||||
@Test
|
@Test
|
||||||
public void startImplement() {
|
public void startImplement() {
|
||||||
try {
|
try {
|
||||||
proxyPurchaseReturn.startImplement("LETS-SH2025010600023310");
|
proxyPurchaseReturn.startImplement("LETS-SH2025010700024055");
|
||||||
|
|
||||||
|
|
||||||
// proxyPurchaseReturn.startImplement("2024-01-01 00:00:00", "2024-08-07 23:59:59");
|
// proxyPurchaseReturn.startImplement("2024-01-01 00:00:00", "2024-08-07 23:59:59");
|
||||||
|
|
|
@ -26,6 +26,6 @@ public class ProxyPurchaseWarehousWarehouseTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void startImplementByCode() {
|
public void startImplementByCode() {
|
||||||
proxyPurchaseWarehousWarehouse.startImplementByCode("LETS-RE2024110500014600");
|
proxyPurchaseWarehousWarehouse.startImplementByCode("LETS-RE2024120300000525");
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue