This commit is contained in:
linfso 2024-06-16 13:27:05 +08:00
parent be2b0dab32
commit f4f8efa713
4 changed files with 85 additions and 30 deletions

View File

@ -44,6 +44,10 @@ public interface EmisSiteBillControlMapper extends BaseMapper<EmisSiteBillContro
* @return 数量
*/
public int checkUnique(EmisSiteBillControl emisSiteBillControl);
/**
@ -77,4 +81,12 @@ public interface EmisSiteBillControlMapper extends BaseMapper<EmisSiteBillContro
* @return 结果
*/
public int deleteEmisSiteBillControlByIds(Long[] ids);
/**
* 检查是否锁账
* @param emisSiteBillControl
* @return
*/
public int checkBillIsLock(EmisSiteBillControl emisSiteBillControl);
}

View File

@ -128,6 +128,8 @@ public class EmisBaseService {
@Autowired
private EmisCountryMapper emisCountryMapper;
@Autowired
private EmisSiteBillControlMapper emisSiteBillControlMapper;
/**
@ -1438,9 +1440,6 @@ public class EmisBaseService {
return true;
}
// 判断系统是否已锁账
// 创建时间<服务器0点 次日9点锁账
Date createTime = emisWaybill.getCreateTime();
@ -1473,13 +1472,36 @@ public class EmisBaseService {
}
/**
* 计算预估到达时间
* @param sendDate 开单时间
* @param prodCode
* @param receiveCountry
* @param sendCountry
* 判断账单锁账
* @param emisWaybill
* @return
*/
public boolean isBillLock(EmisWaybill emisWaybill) {
EmisSiteBillControl emisSiteBillControl = new EmisSiteBillControl();
emisSiteBillControl.setSendSiteCode(emisWaybill.getSendCenterCode());
emisSiteBillControl.setDestSiteCode(emisWaybill.getDestinationCenterCode());
emisSiteBillControl.getParams().put("sendDate",emisWaybill.getSendDate());
int rst=emisSiteBillControlMapper.checkBillIsLock(qParam);
if(rst>0){
return true;
}
return false;
}
/**
* 计算预估到达时间
* @param sendDate 开单时间
* @param prodCode
* @param receiveCountry
* @param sendCountry
* @return
*/
public Date getEstimateDate(Date sendDate,String prodCode,String receiveCountry,String sendCountry,Integer otherAddDay) {
Date estDate = null;

View File

@ -198,6 +198,14 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
dbEmisWaybill.setLockReason("已签收,不允许修改");
}
boolean isBillLock=isBillLock(dbEmisWaybill);
if(isLock){
dbEmisWaybill.setLockFlag("T");
dbEmisWaybill.setLockReason("已锁账,不允许修改");
}else{
dbEmisWaybill.setLockFlag("F");
}
// 收费项
EmisWaybillFeeitem queryFeeitem = new EmisWaybillFeeitem();
queryFeeitem.setWaybillId(dbEmisWaybill.getId());
@ -495,30 +503,33 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
}
}
// 判断运单状态,如果已锁账,则不允许修改
// 下单超过 24小时
// (1)当天开单的,次日9点前允许修改面单;
//(2)当天开单次日上午9点后未锁帐,总部/财务中心修改;
//(3)若运单已签收、已确认账单、已收款、已锁帐,登记申请审批后进行修改;
// DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH:mm:ss");
// LocalTime localTime=LocalTime.parse(time,dtf);
// return LocalTime.now().isAfter(localTime);
if(emisWaybillOld!=null ) {
if (isOutTimeLock(emisWaybillOld)) {
throw new EmisBizError(EmisBizErrorType.BILL_LOCK, "已超时,不允许修改");
}
if ("1".equals(emisWaybillOld.getBlSign())) {
throw new EmisBizError(EmisBizErrorType.BILL_LOCK, "已签收,不允许修改");
}
}
// 新增
if(isNew){
addWayBill(emisWaybillSave);
}else{
// 判断运单状态,如果已锁账,则不允许修改
// 下单超过 24小时
// (1)当天开单的,次日9点前允许修改面单;
//(2)当天开单次日上午9点后未锁帐,总部/财务中心修改;
//(3)若运单已签收、已确认账单、已收款、已锁帐,登记申请审批后进行修改;
if(emisWaybillOld!=null ) {
if (isOutTimeLock(emisWaybillOld)) {
throw new EmisBizError(EmisBizErrorType.BILL_LOCK, "已超时,不允许修改");
}
if ("1".equals(emisWaybillOld.getBlSign())) {
throw new EmisBizError(EmisBizErrorType.BILL_LOCK, "已签收,不允许修改");
}
if (isBillLock(emisWaybillOld)) {
throw new EmisBizError(EmisBizErrorType.BILL_LOCK, "锁账,不允许修改");
}
}
emisWaybillSave.setId(emisWaybillOld.getId());
// 把历史发货日期带过来用于重新计算预估到到时间
emisWaybillSave.setSendDate(emisWaybillOld.getSendDate());

View File

@ -69,6 +69,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and update_site = #{updateSite}
limit 1
</select>
<select id="checkBillIsLock" parameterType="EmisSiteBillControl" resultType="int">
select count(1) from emis_site_bill_control
where del_flag='0'
and send_site_code = #{sendSiteCode}
and dest_site_code = #{destSiteCode}
and #{params.sendDate} <![CDATA[ <= ]]> control_date
and bl_open = '1'
limit 1
</select>
<select id="selectEmisSiteBillControlById" parameterType="Long" resultMap="EmisSiteBillControlResult">
select id, send_site_code, dest_site_code, control_date, bl_open, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
@ -130,11 +140,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteEmisSiteBillControlById" parameterType="Long">
delete from emis_site_bill_control where id = #{id}
update emis_site_bill_control set del_flag='1' where id = #{id}
</delete>
<delete id="deleteEmisSiteBillControlByIds" parameterType="String">
delete from emis_site_bill_control where id in
update emis_site_bill_control set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>