| | |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.date.LocalDateTimeUtil; |
| | | import cn.hutool.core.lang.Assert; |
| | | import cn.hutool.core.util.StrUtil; |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.core.script.DefaultRedisScript; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private final CommonFileServiceImpl commonFileService; |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | private final InvoiceLedgerMapper invoiceLedgerMapper; |
| | | private final SalesLedgerSchedulingMapper salesLedgerSchedulingMapper; |
| | | private final SalesLedgerWorkMapper salesLedgerWorkMapper; |
| | | private final SalesLedgerProductionAccountingMapper salesLedgerProductionAccountingMapper; |
| | | private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper; |
| | | private final InvoiceRegistrationMapper invoiceRegistrationMapper; |
| | | private final ProductOrderMapper productOrderMapper; |
| | | private final ProcessRouteMapper processRouteMapper; |
| | | private final ProductProcessRouteMapper productProcessRouteMapper; |
| | | private final ProcessRouteItemMapper processRouteItemMapper; |
| | | private final ProductProcessRouteItemMapper productProcessRouteItemMapper; |
| | | private final ProductWorkOrderMapper productWorkOrderMapper; |
| | | private final ProductionProductMainMapper productionProductMainMapper; |
| | | private final ProductionProductOutputMapper productionProductOutputMapper; |
| | | private final ProductionProductInputMapper productionProductInputMapper; |
| | | private final QualityInspectMapper qualityInspectMapper; |
| | | private final RedisTemplate<String, String> redisTemplate; |
| | | @Autowired |
| | | private SysDeptMapper sysDeptMapper; |
| | |
| | | @Autowired |
| | | private ProductStructureMapper productStructureMapper; |
| | | @Autowired |
| | | @Lazy |
| | | private ProductionProductMainService productionProductMainService; |
| | | ; |
| | | |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | |
| | | salesLedger.setTenantId(customer.getTenantId()); |
| | | // 3. 新增或更新主表 |
| | | if (salesLedger.getId() == null) { |
| | | String contractNo = generateSalesContractNo(); |
| | | String contractNo = generateSalesContractNoBy8Date(); |
| | | salesLedger.setSalesContractNo(contractNo); |
| | | salesLedgerMapper.insert(salesLedger); |
| | | } else { |
| | |
| | | return entity; |
| | | } |
| | | |
| | | public String generateSalesContractNoBy8Date(){ |
| | | String yyMM = DateUtil.format(new Date(), "yyMM"); |
| | | // 查询一个月有多少订单 |
| | | Date begin = DateUtil.beginOfMonth(new Date()); |
| | | Date end = DateUtil.endOfMonth(new Date()); |
| | | LambdaQueryWrapper<SalesLedger> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.between(SalesLedger::getEntryDate, begin, end); |
| | | long count = salesLedgerMapper.selectCount(queryWrapper); |
| | | return StrUtil.format("{}{:04d}", yyMM, count + 1); |
| | | } |
| | | |
| | | |
| | | |
| | | @Transactional(readOnly = true) |
| | | public String generateSalesContractNo() { |
| | | LocalDate currentDate = LocalDate.now(); |