| | |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | private LocDetlFieldService locDetlFieldService; |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private WaitPakinLogService waitPakinLogService; |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | @Transactional |
| | |
| | | locDetlField.setDetlId(locDetl.getId()); |
| | | locDetlField.setFieldId(detlField.getFieldId()); |
| | | locDetlField.setName(detlField.getName()); |
| | | locDetlField.setValue(detlField.getValue()); |
| | | locDetlField.setHostId(hostId); |
| | | if (!locDetlFieldService.save(locDetlField)) { |
| | | throw new CoolException("插入明细扩展字段失败"); |
| | |
| | | } |
| | | } |
| | | |
| | | //删除组托通知档 |
| | | waitPakinService.remove(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, task.getBarcode()).eq(WaitPakin::getHostId, hostId)); |
| | | //组托通知档转历史档 |
| | | List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, task.getBarcode()).eq(WaitPakin::getHostId, hostId)); |
| | | if(waitPakins.isEmpty()) { |
| | | throw new CoolException("组托通知档不存在"); |
| | | } |
| | | for (WaitPakin waitPakin : waitPakins) { |
| | | WaitPakinLog waitPakinLog = new WaitPakinLog(); |
| | | waitPakinLog.sync(waitPakin); |
| | | if (!waitPakinLogService.save(waitPakinLog)) { |
| | | throw new CoolException("组托通知档转历史档失败"); |
| | | } |
| | | |
| | | //删除组托通知档 |
| | | waitPakinService.removeById(waitPakin.getId()); |
| | | } |
| | | |
| | | break; |
| | | } |
| | |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | }finally { |
| | | InterceptorIgnoreHelper.clearIgnoreStrategy(); |
| | | } |
| | |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | }finally { |
| | | InterceptorIgnoreHelper.clearIgnoreStrategy(); |
| | | } |