| | |
| | | |
| | | pending.setRegistrantId(p.getProducerId()); |
| | | pending.setRegistrationDate(LocalDate.now()); |
| | | |
| | | pending.setCode(generateCode(p.getType())); |
| | | pending.setType(p.getType()); |
| | | pendingInventoryMapper.insert(pending); |
| | | } |
| | | } |
| | | |
| | | private String generateCode(Integer type) { |
| | | LocalDate now = LocalDate.now(); |
| | | String year = now.format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | String s = ""; |
| | | //生成编码 |
| | | switch (type){ |
| | | case 1: |
| | | s = "CP"; |
| | | break; |
| | | case 2: |
| | | s = "YL"; |
| | | break; |
| | | } |
| | | // 查询当天待入库新增条数 |
| | | Long count = pendingInventoryMapper.selectCount(new LambdaQueryWrapper<PendingInventory>() |
| | | .apply("date_trunc('day', create_time) = date_trunc('day', now())")); |
| | | return s + year + String.format("%03d", count + 1); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int delByIds(Long[] ids) { |