| | |
| | | import com.by4cloud.platformx.common.security.util.SecurityUtils; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | * @author syt |
| | | * @date 2026-04-29 11:32:05 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class OutBoundServiceImpl extends ServiceImpl<OutBoundMapper, OutBound> implements OutBoundService { |
| | |
| | | PaymentConfirm lastNewConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, contract.getId()) |
| | | .orderByDesc(PaymentConfirm::getCreateTime).last("limit 1")); |
| | | if (lastNewConfirm.getTotalAmount().compareTo(new BigDecimal("0")) >= 0 |
| | | && contract.getBillingAmout().compareTo(contract.getAmount()) == 0) { |
| | | && contract.getBillingAmout().compareTo(contract.getAmount()) == 0&& |
| | | StrUtil.isBlank(contract.getNextScheduleName())) { |
| | | //有预付且超过应收 关闭合同状态 |
| | | contract.setContractStatus(3); |
| | | contractMapper.updateById(contract); |
| | |
| | | contractOutBound.setLineNo(subjectMatter.getLineNo()); |
| | | contractOutBound.setInvoiceStatus("0"); |
| | | contractOutBound.setInvoiceNum(new BigDecimal("0")); |
| | | contractOutBound.setUnitPrice(subjectMatter.getUnitPrice()); |
| | | contractOutBoundMapper.insert(contractOutBound); |
| | | if (!StrUtil.equals(contract.getContractCategory(), "water_house")) { |
| | | // 1. 确定用于比较的基准日期(优先级:计划交货日期 > 合同到期日期) |
| | |
| | | subjectMatter.setDeliveryStatus(1); |
| | | if (subjectMatter.getRemainingQuantity().compareTo(new BigDecimal("0")) == 0) { |
| | | subjectMatter.setDeliveryStatus(2); |
| | | } |
| | | if (StrUtil.isBlank(subjectMatter.getMaterialCode())){ |
| | | subjectMatter.setMaterialCode(outSubjectMatterAddDTO.getSubjectMatterCode()); |
| | | } |
| | | subjectMatter.setActualDeliveryDate(addDTO.getOutBoundTime()); |
| | | contractSubjectMatterMapper.updateById(subjectMatter); |
| | |
| | | |
| | | @Override |
| | | public R addContractOutSgb(OutBoundAddDTO addDTO) { |
| | | String batchNumber = ""; |
| | | |
| | | if (StrUtil.isNotBlank(addDTO.getOutBoundCode())){ |
| | | batchNumber = addDTO.getOutBoundCode(); |
| | | }else { |
| | | batchNumber = genBatchNumber(); |
| | | } |
| | | log.info("出库单号:{}",batchNumber); |
| | | //校验参数 |
| | | R<Contract> r = vailParam(addDTO); |
| | | if (!r.isOk()) { |
| | | return r; |
| | | } |
| | | Contract contract = r.getData(); |
| | | String batchNumber = genBatchNumber(); |
| | | |
| | | //出库 |
| | | handleOutBound(batchNumber,contract, addDTO); |
| | | |