| | |
| | | |
| | | mapper.insert(productHistory); |
| | | } |
| | | |
| | | public void updateEnabledStatus(String parentCode, String customCode, int status) { |
| | | int anotherStatus = 0; |
| | | if(status==0){ |
| | | anotherStatus=1; |
| | | }else{ |
| | | anotherStatus=0; |
| | | } |
| | | UpdateWrapper<ProductHistory> update = Wrappers.update(); |
| | | update.set("enabled",status).eq("parent_code",parentCode) |
| | | .eq("custom_code",customCode).eq("enabled",anotherStatus); |
| | | mapper.update(null,update); |
| | | } |
| | | } |
| | |
| | | public Product getById(Integer id) { |
| | | return mapper.selectById(id); |
| | | } |
| | | |
| | | public void deleteByParentCodeAndCustomCode(String parentCode, String customCode) { |
| | | UpdateWrapper<Product> update = Wrappers.update(); |
| | | update.eq("parent_code",parentCode).eq("custom_code",customCode); |
| | | mapper.delete(update); |
| | | } |
| | | } |
| | |
| | | productHistory.setVersion(nextVersion); |
| | | productHistory.setEnabled(1); |
| | | |
| | | //实际生效的只有insert,因为状态设置为未启用已经在提交审批时变更了 |
| | | phService.insertAndUpdateEnabled(productHistory); |
| | | int productId = productService.updateVersion(parentCode,customCode,nextVersion); |
| | | |
| | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | @Autowired |
| | | private ProductHistoryService productHistoryService; |
| | | |
| | | @Transactional |
| | | public boolean submit(WorksheetMain main, DocUser user) throws IOException { |
| | | main.setType(1); |
| | |
| | | bomList.add(approving); |
| | | }); |
| | | } |
| | | //冻结(不启用)已存在的产品编码+定制保单号 |
| | | productService.deleteByParentCodeAndCustomCode(productApproving.getParentCode(),productApproving.getCustomCode()); |
| | | productHistoryService.updateEnabledStatus(productApproving.getParentCode(),productApproving.getCustomCode(),0); |
| | | |
| | | productApproving.setMainId(main.getId()); |
| | | productApproving.setCreateTime(new Date()); |
| | | paService.insert(productApproving); |