| | |
| | | import com.whyc.pojo.*; |
| | | import com.whyc.util.CommonUtil; |
| | | import com.whyc.util.Zip4jUtil; |
| | | import org.aspectj.util.FileUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.FileCopyUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | @Autowired |
| | | private ProductHistoryService productHistoryService; |
| | | |
| | | @Transactional |
| | | public boolean submit(WorksheetMain main, DocUser user) throws IOException { |
| | |
| | | String dateFormat = new SimpleDateFormat("YYYY-MM").format(new Date()); |
| | | long timeStamp = System.currentTimeMillis(); |
| | | String filePath = rootFile + "product_approving" + File.separator + user.getName() + File.separator + dateFormat+ File.separator + timeStamp; |
| | | String inFilePath = rootFile + "product" + File.separator + product.getParentModel() + File.separator + "standard"+ File.separator; |
| | | String inFilePath = rootFile + "product" + File.separator + product.getParentModel() + File.separator + "standard"+ File.separator + product.getVersion(); |
| | | File parentFile = new File(filePath); |
| | | FileCopyUtils.copy(new File(inFilePath),parentFile); |
| | | |
| | | //FileCopyUtils.copy(new File(inFilePath),parentFile); |
| | | FileUtil.copyDir(new File(inFilePath),parentFile); |
| | | productApproving.setFileUrl(filePath); |
| | | bomList.clear(); |
| | | productBomList.forEach(bom->{ |
| | |
| | | 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); |
| | |
| | | List<MaterialProductApproving> approvingList = new LinkedList<>(); |
| | | WorksheetMain main = mainDTO.getMain(); |
| | | List<MaterialProductApproving> addedList = mainDTO.getAddedList(); |
| | | List<MaterialProductApproving> replacedList = mainDTO.getReplacedList(); |
| | | //List<MaterialProductApproving> replacedList = mainDTO.getReplacedList(); |
| | | List<MaterialProductApproving> removedList = mainDTO.getRemovedList(); |
| | | |
| | | main.setType(EnumWorksheetType.MaterialProduct.getType()); |
| | |
| | | }); |
| | | approvingList.addAll(addedList); |
| | | } |
| | | if(replacedList!=null && replacedList.size()!=0){ |
| | | /*if(replacedList!=null && replacedList.size()!=0){ |
| | | replacedList.forEach(item->{ |
| | | item.setMainId(main.getId()); |
| | | item.setLinkType(2); |
| | | }); |
| | | approvingList.addAll(replacedList); |
| | | } |
| | | }*/ |
| | | if(removedList!=null && removedList.size()!=0){ |
| | | removedList.forEach(item->{ |
| | | item.setMainId(main.getId()); |
| | |
| | | //判断是哪种类型的审批,返回不同的类型 具体数据 |
| | | Integer type = getInfoById(id).getType(); |
| | | if(type.intValue() == EnumWorksheetType.ProductBom.getType()) { |
| | | return mainMapper.getLinkList(id); |
| | | WorksheetMain main = mainMapper.getLinkList(id); |
| | | List<ProductBomApproving> pbaList = approvingService.getList(main.getProductApproving().getId()); |
| | | main.getProductApproving().setBomApprovingList(pbaList); |
| | | return main; |
| | | }else if(type.intValue() == EnumWorksheetType.Material.getType()){ |
| | | //lxw注释 |
| | | //return mainMapper.getLinkListWithMaterials(id); |
| | | return null; |
| | | return mainMapper.getLinkListWithMaterials(id); |
| | | }else{ //物料-产品 |
| | | //return mainMapper.getLinkListWithMaterialProducts(id); |
| | | return null; |
| | | return mainMapper.getLinkListWithMaterialProducts(id); |
| | | } |
| | | } |
| | | |