md
This commit is contained in:
parent
02326cb40d
commit
6f3931c847
@ -44,6 +44,8 @@ package com.xdadan.erp.emis.service;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -2338,9 +2340,9 @@ public class EmisBaseService {
|
|||||||
startDate=currentTime;
|
startDate=currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 开单当天不算时效
|
// 计算延长时间
|
||||||
Date newEstDate = getEstimateDate(
|
Date newEstDate = getEstimateDateByProm(
|
||||||
startDate,oldEmisWaybill.getProductType(),
|
startDate,
|
||||||
oldEmisWaybill.getSendCountry(),
|
oldEmisWaybill.getSendCountry(),
|
||||||
oldEmisWaybill.getReceiveCountry(),emisProblemType.getDelayDay());
|
oldEmisWaybill.getReceiveCountry(),emisProblemType.getDelayDay());
|
||||||
|
|
||||||
@ -3774,14 +3776,14 @@ public class EmisBaseService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算预估到达时间
|
* 计算预估到达时间,根据产品时效来计算
|
||||||
* @param sendDate 开单时间
|
* @param sendDate 开单时间
|
||||||
* @param prodCode
|
* @param prodCode
|
||||||
* @param receiveCountry
|
* @param receiveCountry
|
||||||
* @param sendCountry
|
* @param sendCountry
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Date getEstimateDate(Date sendDate,String prodCode,String receiveCountry,String sendCountry,Integer otherAddDay) {
|
public Date getEstimateDate(Date sendDate,String prodCode,String receiveCountry,String sendCountry,Integer otherAddDay) {
|
||||||
Date estDate = null;
|
Date estDate = null;
|
||||||
|
|
||||||
@ -3817,7 +3819,7 @@ public class EmisBaseService {
|
|||||||
startDate,
|
startDate,
|
||||||
endDate);
|
endDate);
|
||||||
|
|
||||||
// 1+1+
|
// 1+1+ 5+0-1+2+0
|
||||||
int totalDays=(emisTransProduct.getMaxAging()+otherAddDay-1)+weekDays+notCaclDays;
|
int totalDays=(emisTransProduct.getMaxAging()+otherAddDay-1)+weekDays+notCaclDays;
|
||||||
log.info("计算预估到达时间:[maxAging="+emisTransProduct.getMaxAging()+",weekDays="+weekDays+",notCaclDays="+notCaclDays);
|
log.info("计算预估到达时间:[maxAging="+emisTransProduct.getMaxAging()+",weekDays="+weekDays+",notCaclDays="+notCaclDays);
|
||||||
// 预估达到时间
|
// 预估达到时间
|
||||||
@ -3825,6 +3827,53 @@ public class EmisBaseService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据问题件时间延长时效
|
||||||
|
* @param sendDate 开单时间
|
||||||
|
* @param receiveCountry
|
||||||
|
* @param sendCountry
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Date getEstimateDateByProm(Date sendDate,String receiveCountry,String sendCountry,Integer otherAddDay) {
|
||||||
|
Date estDate = null;
|
||||||
|
|
||||||
|
if(otherAddDay==null){
|
||||||
|
otherAddDay=0;
|
||||||
|
}
|
||||||
|
// 发件时间+1天,从下一天的0点开始算
|
||||||
|
sendDate = DateUtils.addDays(sendDate,1);
|
||||||
|
|
||||||
|
// 初始化0点时间
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(sendDate);
|
||||||
|
calendar.set(Calendar.SECOND, 0);
|
||||||
|
calendar.set(Calendar.MINUTE, 0);
|
||||||
|
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
calendar.set(Calendar.MILLISECOND, 0);
|
||||||
|
|
||||||
|
Date startDate=calendar.getTime();
|
||||||
|
|
||||||
|
// 预估到达时间 startData+最大时效
|
||||||
|
Date endDate = DateUtils.addDays(startDate, otherAddDay-1);
|
||||||
|
|
||||||
|
// 计算周末
|
||||||
|
int weekDays = computeWeekDays(startDate,endDate,true);
|
||||||
|
|
||||||
|
// 计算不计较时效的时间
|
||||||
|
int notCaclDays=emisNotCalcAgingMapper.getNotCalcAgingDays(
|
||||||
|
receiveCountry,
|
||||||
|
sendCountry,
|
||||||
|
startDate,
|
||||||
|
endDate);
|
||||||
|
|
||||||
|
// 1+1+ 5+0-1+2+0
|
||||||
|
int totalDays=(otherAddDay-1)+weekDays+notCaclDays;
|
||||||
|
log.info("计算预估到达时间:[weekDays="+weekDays+",notCaclDays="+notCaclDays);
|
||||||
|
// 预估达到时间
|
||||||
|
return DateUtils.addDays(startDate, totalDays);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -3995,11 +4044,13 @@ public class EmisBaseService {
|
|||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) throws ParseException {
|
||||||
// Date startDate = new Date();
|
// Date startDate = new Date("202");
|
||||||
// Date endDate = DateUtils.addDays(startDate, 10);
|
Date startDate= new SimpleDateFormat("yyyy-MM-dd").parse("2025-05-11");
|
||||||
// int weekDays = computeWeekDays(startDate,endDate,true);
|
Date endDate = DateUtils.addDays(startDate, 5);
|
||||||
//// System.out.println("周末:"+new SimpleDateFormat("yyyy-MM-dd").format(cal1.getTime()));
|
int weekDays = computeWeekDays(startDate,endDate,true);
|
||||||
|
System.out.println(weekDays);
|
||||||
|
// System.out.println("周末:"+new SimpleDateFormat("yyyy-MM-dd").format(cal1.getTime()));
|
||||||
//
|
//
|
||||||
// System.out.println(startDate);
|
// System.out.println(startDate);
|
||||||
// System.out.println(endDate);
|
// System.out.println(endDate);
|
||||||
|
|||||||
@ -2001,6 +2001,7 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
|
|||||||
}else{
|
}else{
|
||||||
waybillProblemInfo.setBlSubBill("0");
|
waybillProblemInfo.setBlSubBill("0");
|
||||||
}
|
}
|
||||||
|
// 登记问题件并计算延期时间
|
||||||
registerWaybillProblemInfo(waybillProblemInfo);
|
registerWaybillProblemInfo(waybillProblemInfo);
|
||||||
if(waybillProblemInfo.getId()!=null) {
|
if(waybillProblemInfo.getId()!=null) {
|
||||||
emisTmsScanRecord.setRelId(waybillProblemInfo.getId().toString());
|
emisTmsScanRecord.setRelId(waybillProblemInfo.getId().toString());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user