|
@@ -194,6 +194,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
int month = date.getMonthValue();
|
|
int month = date.getMonthValue();
|
|
|
FinPeriod finPeriod = finPeriodMapper.selectOne(new LambdaQueryWrapper<FinPeriod>()
|
|
FinPeriod finPeriod = finPeriodMapper.selectOne(new LambdaQueryWrapper<FinPeriod>()
|
|
|
.eq(FinPeriod::getTenantId, AuthUtil.getTenantId())
|
|
.eq(FinPeriod::getTenantId, AuthUtil.getTenantId())
|
|
|
|
|
+ .eq(FinPeriod::getBranchId, bills.getBranchId())
|
|
|
.eq(FinPeriod::getIsDeleted, 0)
|
|
.eq(FinPeriod::getIsDeleted, 0)
|
|
|
.eq(FinPeriod::getPeriodYear, year)
|
|
.eq(FinPeriod::getPeriodYear, year)
|
|
|
.eq(FinPeriod::getPeriodMonth, month));
|
|
.eq(FinPeriod::getPeriodMonth, month));
|
|
@@ -408,6 +409,16 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
String exrateType = currencyUtils.standardCurrency(branchId);
|
|
String exrateType = currencyUtils.standardCurrency(branchId);
|
|
|
statusC += 1;
|
|
statusC += 1;
|
|
|
for (FeeCenter item : bills.getFeeCenterListC()) {
|
|
for (FeeCenter item : bills.getFeeCenterListC()) {
|
|
|
|
|
+ if (ObjectUtils.isNotNull(bills.getPreContainersList())) {
|
|
|
|
|
+ PreContainers preContainers = bills.getPreContainersList().stream().filter(e -> e.getCntrTypeCode().equals(item.getUnitNo()))
|
|
|
|
|
+ .findFirst().orElse(null);
|
|
|
|
|
+ if (preContainers != null && item.getQuantity().compareTo(new BigDecimal(preContainers.getQuantity() + "")) != 0 &&
|
|
|
|
|
+ "0,1".contains(item.getAuditStatus())) {
|
|
|
|
|
+ item.setQuantity(new BigDecimal(preContainers.getQuantity() + ""));
|
|
|
|
|
+ item.setAmount(item.getPrice().multiply(item.getQuantity()));
|
|
|
|
|
+ item.setAmountLoc(item.getAmount().multiply(item.getExrate()));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
item.setPid(bills.getId());
|
|
item.setPid(bills.getId());
|
|
|
item.setBillNo(bills.getBillNo());
|
|
item.setBillNo(bills.getBillNo());
|
|
|
item.setBusinessType(bills.getBusinessType());
|
|
item.setBusinessType(bills.getBusinessType());
|
|
@@ -468,6 +479,16 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
String exrateType = currencyUtils.standardCurrency(branchId);
|
|
String exrateType = currencyUtils.standardCurrency(branchId);
|
|
|
statusD += 1;
|
|
statusD += 1;
|
|
|
for (FeeCenter item : bills.getFeeCenterListD()) {
|
|
for (FeeCenter item : bills.getFeeCenterListD()) {
|
|
|
|
|
+ if (ObjectUtils.isNotNull(bills.getPreContainersList())) {
|
|
|
|
|
+ PreContainers preContainers = bills.getPreContainersList().stream().filter(e -> e.getCntrTypeCode().equals(item.getUnitNo()))
|
|
|
|
|
+ .findFirst().orElse(null);
|
|
|
|
|
+ if (preContainers != null && item.getQuantity().compareTo(new BigDecimal(preContainers.getQuantity() + "")) != 0 &&
|
|
|
|
|
+ "0,1".contains(item.getAuditStatus())) {
|
|
|
|
|
+ item.setQuantity(new BigDecimal(preContainers.getQuantity() + ""));
|
|
|
|
|
+ item.setAmount(item.getPrice().multiply(item.getQuantity()));
|
|
|
|
|
+ item.setAmountLoc(item.getAmount().multiply(item.getExrate()));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
item.setPid(bills.getId());
|
|
item.setPid(bills.getId());
|
|
|
item.setBillNo(bills.getBillNo());
|
|
item.setBillNo(bills.getBillNo());
|
|
|
item.setBusinessType(bills.getBusinessType());
|
|
item.setBusinessType(bills.getBusinessType());
|
|
@@ -1167,6 +1188,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
int month = date.getMonthValue();
|
|
int month = date.getMonthValue();
|
|
|
FinPeriod finPeriod = finPeriodMapper.selectOne(new LambdaQueryWrapper<FinPeriod>()
|
|
FinPeriod finPeriod = finPeriodMapper.selectOne(new LambdaQueryWrapper<FinPeriod>()
|
|
|
.eq(FinPeriod::getTenantId, AuthUtil.getTenantId())
|
|
.eq(FinPeriod::getTenantId, AuthUtil.getTenantId())
|
|
|
|
|
+ .eq(FinPeriod::getBranchId, bills.getBranchId())
|
|
|
.eq(FinPeriod::getIsDeleted, 0)
|
|
.eq(FinPeriod::getIsDeleted, 0)
|
|
|
.eq(FinPeriod::getPeriodYear, year)
|
|
.eq(FinPeriod::getPeriodYear, year)
|
|
|
.eq(FinPeriod::getPeriodMonth, month));
|
|
.eq(FinPeriod::getPeriodMonth, month));
|
|
@@ -1276,6 +1298,9 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
item.setShippingAgencyEname(bills.getShippingAgencyEname());
|
|
item.setShippingAgencyEname(bills.getShippingAgencyEname());
|
|
|
item.setMasterId(bills.getId());
|
|
item.setMasterId(bills.getId());
|
|
|
item.setMasterBillNo(bills.getBillNo());
|
|
item.setMasterBillNo(bills.getBillNo());
|
|
|
|
|
+ item.setPlaceDeliveryId(bills.getPlaceDeliveryId());
|
|
|
|
|
+ item.setPlaceDeliveryName(bills.getPlaceDeliveryName());
|
|
|
|
|
+ item.setPlaceDeliveryCode(bills.getPlaceDeliveryCode());
|
|
|
item.setDestinationId(bills.getDestinationId());
|
|
item.setDestinationId(bills.getDestinationId());
|
|
|
item.setDestinationName(bills.getDestinationName());
|
|
item.setDestinationName(bills.getDestinationName());
|
|
|
item.setDestinationCode(bills.getDestinationCode());
|
|
item.setDestinationCode(bills.getDestinationCode());
|
|
@@ -2701,6 +2726,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
int month = date2.getMonthValue();
|
|
int month = date2.getMonthValue();
|
|
|
FinPeriod finPeriod = finPeriodMapper.selectOne(new LambdaQueryWrapper<FinPeriod>()
|
|
FinPeriod finPeriod = finPeriodMapper.selectOne(new LambdaQueryWrapper<FinPeriod>()
|
|
|
.eq(FinPeriod::getTenantId, AuthUtil.getTenantId())
|
|
.eq(FinPeriod::getTenantId, AuthUtil.getTenantId())
|
|
|
|
|
+ .eq(FinPeriod::getBranchId, bills.getBranchId())
|
|
|
.eq(FinPeriod::getIsDeleted, 0)
|
|
.eq(FinPeriod::getIsDeleted, 0)
|
|
|
.eq(FinPeriod::getPeriodYear, year)
|
|
.eq(FinPeriod::getPeriodYear, year)
|
|
|
.eq(FinPeriod::getPeriodMonth, month));
|
|
.eq(FinPeriod::getPeriodMonth, month));
|
|
@@ -3076,6 +3102,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
int month = date.getMonthValue();
|
|
int month = date.getMonthValue();
|
|
|
FinPeriod finPeriod = finPeriodMapper.selectOne(new LambdaQueryWrapper<FinPeriod>()
|
|
FinPeriod finPeriod = finPeriodMapper.selectOne(new LambdaQueryWrapper<FinPeriod>()
|
|
|
.eq(FinPeriod::getTenantId, AuthUtil.getTenantId())
|
|
.eq(FinPeriod::getTenantId, AuthUtil.getTenantId())
|
|
|
|
|
+ .eq(FinPeriod::getBranchId, billsJk.getBranchId())
|
|
|
.eq(FinPeriod::getIsDeleted, 0)
|
|
.eq(FinPeriod::getIsDeleted, 0)
|
|
|
.eq(FinPeriod::getPeriodYear, year)
|
|
.eq(FinPeriod::getPeriodYear, year)
|
|
|
.eq(FinPeriod::getPeriodMonth, month));
|
|
.eq(FinPeriod::getPeriodMonth, month));
|
|
@@ -4382,6 +4409,11 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
throw new RuntimeException("缺少必要参数");
|
|
throw new RuntimeException("缺少必要参数");
|
|
|
}
|
|
}
|
|
|
Bills detail = baseMapper.selectById(bills.getId());
|
|
Bills detail = baseMapper.selectById(bills.getId());
|
|
|
|
|
+ if (ObjectUtils.isNotNull(bills.getConfirmStatus()) && "1".equals(bills.getConfirmStatus())) {
|
|
|
|
|
+ if (!detail.getConfirmStatus().equals(bills.getConfirmStatus())) {
|
|
|
|
|
+ throw new RuntimeException("提单未确认");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
SeaBillsDetail seaBillsDetail = seaBillsDetailService.getOne(new LambdaQueryWrapper<SeaBillsDetail>()
|
|
SeaBillsDetail seaBillsDetail = seaBillsDetailService.getOne(new LambdaQueryWrapper<SeaBillsDetail>()
|
|
|
.eq(SeaBillsDetail::getTenantId, AuthUtil.getTenantId())
|
|
.eq(SeaBillsDetail::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(SeaBillsDetail::getPid, detail.getId()));
|
|
.eq(SeaBillsDetail::getPid, detail.getId()));
|
|
@@ -4574,13 +4606,6 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
if (fees == null) {
|
|
if (fees == null) {
|
|
|
throw new RuntimeException("未查到海运费信息,请先维护基础资料");
|
|
throw new RuntimeException("未查到海运费信息,请先维护基础资料");
|
|
|
}
|
|
}
|
|
|
- BFees feesD = bFeesService.getOne(new LambdaQueryWrapper<BFees>()
|
|
|
|
|
- .eq(BFees::getTenantId, AuthUtil.getTenantId())
|
|
|
|
|
- .eq(BFees::getIsDeleted, 0)
|
|
|
|
|
- .eq(BFees::getCode, "XSJ"));
|
|
|
|
|
- if (feesD == null) {
|
|
|
|
|
- throw new RuntimeException("未查到销售价信息,请先维护基础资料");
|
|
|
|
|
- }
|
|
|
|
|
String deptName = copyBills.getBranchName();
|
|
String deptName = copyBills.getBranchName();
|
|
|
String branchId = copyBills.getBranchId();
|
|
String branchId = copyBills.getBranchId();
|
|
|
List<FeeCenter> feeCenters = new ArrayList<>();
|
|
List<FeeCenter> feeCenters = new ArrayList<>();
|
|
@@ -4599,7 +4624,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
feeCenterListSum.add(feeCenter);
|
|
feeCenterListSum.add(feeCenter);
|
|
|
}
|
|
}
|
|
|
if (!"SOC".equals(copyBills.getBoxBelongsTo())) {
|
|
if (!"SOC".equals(copyBills.getBoxBelongsTo())) {
|
|
|
- FeeCenter feeCenterD = this.addFeeCenterQuotation(copyBills, "C", count, feesD, item,
|
|
|
|
|
|
|
+ FeeCenter feeCenterD = this.addFeeCenterQuotation(copyBills, "C", count, fees, item,
|
|
|
curExrateList, exrateType, "2");
|
|
curExrateList, exrateType, "2");
|
|
|
if (feeCenterD != null) {
|
|
if (feeCenterD != null) {
|
|
|
feeCenterD.setUnitNo(item.getCntrTypeCode());
|
|
feeCenterD.setUnitNo(item.getCntrTypeCode());
|
|
@@ -5190,6 +5215,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
int month = date.getMonthValue();
|
|
int month = date.getMonthValue();
|
|
|
FinPeriod finPeriod = finPeriodMapper.selectOne(new LambdaQueryWrapper<FinPeriod>()
|
|
FinPeriod finPeriod = finPeriodMapper.selectOne(new LambdaQueryWrapper<FinPeriod>()
|
|
|
.eq(FinPeriod::getTenantId, AuthUtil.getTenantId())
|
|
.eq(FinPeriod::getTenantId, AuthUtil.getTenantId())
|
|
|
|
|
+ .eq(FinPeriod::getBranchId, declare.getBranchId())
|
|
|
.eq(FinPeriod::getIsDeleted, 0)
|
|
.eq(FinPeriod::getIsDeleted, 0)
|
|
|
.eq(FinPeriod::getPeriodYear, year)
|
|
.eq(FinPeriod::getPeriodYear, year)
|
|
|
.eq(FinPeriod::getPeriodMonth, month));
|
|
.eq(FinPeriod::getPeriodMonth, month));
|
|
@@ -5223,6 +5249,125 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
return declare;
|
|
return declare;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public R billLadingConfirm(Bills bills) {
|
|
|
|
|
+ if (ObjectUtils.isNull(bills.getTemporaryId()) || ObjectUtils.isNull(bills.getId())) {
|
|
|
|
|
+ throw new RuntimeException("缺少必要参数");
|
|
|
|
|
+ }
|
|
|
|
|
+ Bills billsFd = baseMapper.selectById(bills.getId());
|
|
|
|
|
+ if (billsFd == null) {
|
|
|
|
|
+ throw new RuntimeException("未查到单据信息");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ObjectUtils.isNotNull(billsFd.getCyTrailerTime()) && billsFd.getCyTrailerTime().compareTo(new Date()) < 0) {
|
|
|
|
|
+ throw new RuntimeException("本单据已截单");
|
|
|
|
|
+ }
|
|
|
|
|
+ SeaBillsDetail seaBillsDetailFd = seaBillsDetailService.getOne(new LambdaQueryWrapper<SeaBillsDetail>()
|
|
|
|
|
+ .eq(SeaBillsDetail::getTenantId, AuthUtil.getTenantId())
|
|
|
|
|
+ .eq(SeaBillsDetail::getPid, billsFd.getId()));
|
|
|
|
|
+ if (seaBillsDetailFd == null) {
|
|
|
|
|
+ throw new RuntimeException("未查到单据信息");
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Containers> containersFdList = containersService.list(new LambdaQueryWrapper<Containers>()
|
|
|
|
|
+ .eq(Containers::getIsDeleted, 0)
|
|
|
|
|
+ .eq(Containers::getTenantId, AuthUtil.getTenantId())
|
|
|
|
|
+ .eq(Containers::getPid, billsFd.getId()));
|
|
|
|
|
+ Bills billsBooking = baseMapper.selectById(bills.getTemporaryId());
|
|
|
|
|
+ if (billsBooking == null) {
|
|
|
|
|
+ throw new RuntimeException("未查到订舱单据信息");
|
|
|
|
|
+ }
|
|
|
|
|
+ SeaBillsDetail seaBillsDetailBooking = seaBillsDetailService.getOne(new LambdaQueryWrapper<SeaBillsDetail>()
|
|
|
|
|
+ .eq(SeaBillsDetail::getTenantId, AuthUtil.getTenantId())
|
|
|
|
|
+ .eq(SeaBillsDetail::getPid, billsBooking.getId()));
|
|
|
|
|
+ if (seaBillsDetailBooking == null) {
|
|
|
|
|
+ throw new RuntimeException("未查到订舱单据信息");
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Containers> containersBookingList = containersService.list(new LambdaQueryWrapper<Containers>()
|
|
|
|
|
+ .eq(Containers::getIsDeleted, 0)
|
|
|
|
|
+ .eq(Containers::getTenantId, AuthUtil.getTenantId())
|
|
|
|
|
+ .eq(Containers::getPid, billsBooking.getId()));
|
|
|
|
|
+ if (containersBookingList.isEmpty()) {
|
|
|
|
|
+ throw new RuntimeException("未查到订舱单据配箱信息");
|
|
|
|
|
+ }
|
|
|
|
|
+ //覆盖主表信息
|
|
|
|
|
+ billsFd.setPolId(billsBooking.getPolId());
|
|
|
|
|
+ billsFd.setPolCode(billsBooking.getPolCode());
|
|
|
|
|
+ billsFd.setPolCnName(billsBooking.getPolCnName());
|
|
|
|
|
+ billsFd.setPolEnName(billsBooking.getPolEnName());
|
|
|
|
|
+ billsFd.setPodId(billsBooking.getPodId());
|
|
|
|
|
+ billsFd.setPodCode(billsBooking.getPodCode());
|
|
|
|
|
+ billsFd.setPodCnName(billsBooking.getPodCnName());
|
|
|
|
|
+ billsFd.setPodEnName(billsBooking.getPodEnName());
|
|
|
|
|
+ billsFd.setMarks(billsBooking.getMarks());
|
|
|
|
|
+ billsFd.setCommodityDescr(billsBooking.getMarks());
|
|
|
|
|
+ billsFd.setHpaymode(billsBooking.getMpaymode());
|
|
|
|
|
+ billsFd.setMpaymode(billsBooking.getMpaymode());
|
|
|
|
|
+ billsFd.setServiceTerms(billsBooking.getServiceTerms());
|
|
|
|
|
+ billsFd.setQuantity(billsBooking.getQuantity());
|
|
|
|
|
+ billsFd.setGrossWeight(billsBooking.getGrossWeight());
|
|
|
|
|
+ billsFd.setMeasurement(billsBooking.getMeasurement());
|
|
|
|
|
+ baseMapper.updateById(billsFd);
|
|
|
|
|
+ //覆盖主表从表明细信息
|
|
|
|
|
+ seaBillsDetailFd.setHnotifyDetails(seaBillsDetailBooking.getHnotifyDetails());
|
|
|
|
|
+ seaBillsDetailFd.setHconsigneeDetails(seaBillsDetailBooking.getHconsigneeDetails());
|
|
|
|
|
+ seaBillsDetailFd.setHshipperDetails(seaBillsDetailBooking.getHshipperDetails());
|
|
|
|
|
+ seaBillsDetailService.updateById(seaBillsDetailFd);
|
|
|
|
|
+ //配箱信息处理
|
|
|
|
|
+ List<Containers> containersList = new ArrayList<>();
|
|
|
|
|
+ if (containersFdList.isEmpty()) {
|
|
|
|
|
+ for (Containers item : containersBookingList) {
|
|
|
|
|
+ item.setPid(billsFd.getId());
|
|
|
|
|
+ item.setId(null);
|
|
|
|
|
+ item.setMblno(billsFd.getMblno());
|
|
|
|
|
+ item.setHblno(billsFd.getHblno());
|
|
|
|
|
+ item.setCreateTime(new Date());
|
|
|
|
|
+ item.setCreateUser(AuthUtil.getUserId());
|
|
|
|
|
+ item.setCreateUserName(AuthUtil.getUserName());
|
|
|
|
|
+ item.setUpdateUser(null);
|
|
|
|
|
+ item.setUpdateUserName(null);
|
|
|
|
|
+ item.setUpdateTime(null);
|
|
|
|
|
+ containersList.add(item);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ List<String> cntrNoList = containersFdList.stream().map(Containers::getCntrNo).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
|
|
+ List<String> cntrNoBookingList = containersBookingList.stream().map(Containers::getCntrNo).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
|
|
+ if (cntrNoList.size() != cntrNoBookingList.size()) {
|
|
|
|
|
+ containersService.removeByIds(containersFdList.stream().map(Containers::getId).collect(Collectors.toList()));
|
|
|
|
|
+ for (Containers item : containersBookingList) {
|
|
|
|
|
+ item.setPid(billsFd.getId());
|
|
|
|
|
+ item.setId(null);
|
|
|
|
|
+ item.setMblno(billsFd.getMblno());
|
|
|
|
|
+ item.setHblno(billsFd.getHblno());
|
|
|
|
|
+ item.setCreateTime(new Date());
|
|
|
|
|
+ item.setCreateUser(AuthUtil.getUserId());
|
|
|
|
|
+ item.setCreateUserName(AuthUtil.getUserName());
|
|
|
|
|
+ item.setUpdateUser(null);
|
|
|
|
|
+ item.setUpdateUserName(null);
|
|
|
|
|
+ item.setUpdateTime(null);
|
|
|
|
|
+ containersList.add(item);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ for (Containers item : containersFdList) {
|
|
|
|
|
+ Containers containers = containersBookingList.stream().filter(e -> e.getCntrNo().equals(item.getCntrNo()))
|
|
|
|
|
+ .findFirst().orElse(null);
|
|
|
|
|
+ if (containers != null) {
|
|
|
|
|
+ item.setSealNo(containers.getSealNo());
|
|
|
|
|
+ item.setGrossWeight(containers.getGrossWeight());
|
|
|
|
|
+ item.setQuantity(containers.getQuantity());
|
|
|
|
|
+ item.setMeasurement(containers.getMeasurement());
|
|
|
|
|
+ item.setTare(containers.getTare());
|
|
|
|
|
+ item.setVgmWeight(containers.getVgmWeight());
|
|
|
|
|
+ containersList.add(item);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!containersList.isEmpty()) {
|
|
|
|
|
+ containersService.saveOrUpdateBatch(containersList);
|
|
|
|
|
+ }
|
|
|
|
|
+ return R.data(billsFd);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 删除海运进出口明细表
|
|
* 删除海运进出口明细表
|
|
|
*
|
|
*
|