| | |
| | | import com.whyc.mapper.WorksheetLinkMapper; |
| | | import com.whyc.mapper.WorksheetMainMapper; |
| | | import com.whyc.pojo.*; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.CommonUtil; |
| | | import com.whyc.util.Zip4jUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private ProductBomApprovingService approvingService; |
| | | |
| | | @Autowired |
| | | private ComponentProductApprovingService cpApprovingService; |
| | | private MaterialProductApprovingService cpApprovingService; |
| | | |
| | | @Autowired |
| | | private ComponentApprovingService cApprovingService; |
| | | private MaterialApprovingService cApprovingService; |
| | | |
| | | @Autowired |
| | | private ComponentService cService; |
| | | private MaterialService cService; |
| | | |
| | | @Autowired |
| | | private ProductBomService pbService; |
| | | |
| | | @Autowired |
| | | private ComponentProductHistoryService cphService; |
| | | private MaterialProductHistoryService cphService; |
| | | |
| | | @Autowired |
| | | private ProductSoftwareApprovingService psaService; |
| | |
| | | bomList.forEach(bom->{ |
| | | bom.setMainId(main.getId()); |
| | | bom.setUpUserId(user.getId()); |
| | | bom.setRejectVersion(nextRejectVersion); |
| | | //lxw注释 |
| | | //bom.setRejectVersion(nextRejectVersion); |
| | | bom.setCreateDate(new Date()); |
| | | if(bom.getDwgUrl()==null){ |
| | | bom.setDwgUrl(""); |
| | |
| | | return true; |
| | | } |
| | | |
| | | public boolean componentProductSubmit(WorksheetMainDTO mainDTO, DocUser user) { |
| | | List<ComponentProductApproving> approvingList = new LinkedList<>(); |
| | | public boolean MaterialProductSubmit(WorksheetMainDTO mainDTO, DocUser user) { |
| | | List<MaterialProductApproving> approvingList = new LinkedList<>(); |
| | | WorksheetMain main = mainDTO.getMain(); |
| | | List<ComponentProductApproving> addedList = mainDTO.getAddedList(); |
| | | List<ComponentProductApproving> replacedList = mainDTO.getReplacedList(); |
| | | List<ComponentProductApproving> removedList = mainDTO.getRemovedList(); |
| | | List<MaterialProductApproving> addedList = mainDTO.getAddedList(); |
| | | List<MaterialProductApproving> replacedList = mainDTO.getReplacedList(); |
| | | List<MaterialProductApproving> removedList = mainDTO.getRemovedList(); |
| | | |
| | | main.setType(EnumWorksheetType.ComponentProduct.getType()); |
| | | main.setType(EnumWorksheetType.MaterialProduct.getType()); |
| | | //提交主表 |
| | | main.setCreateUserId(user.getId()); |
| | | //提交人角色来判断工作流层级 |
| | |
| | | return true; |
| | | } |
| | | |
| | | public Response componentSubmit(WorksheetMain main, DocUser user) { |
| | | public Response MaterialSubmit(WorksheetMain main, DocUser user) { |
| | | Response<Object> response = new Response<>(); |
| | | List<ComponentApproving> cApprovingList = main.getCApprovingList(); |
| | | List<MaterialApproving> cApprovingList = main.getCApprovingList(); |
| | | //判断是新增还是删除 |
| | | boolean isAdded = cApprovingList.get(0).getSubName()!=null; |
| | | if(isAdded) { //新增 |
| | | //查询是否有 已生效或者已提交审批的 相同的散装件 |
| | | List<Component> existComponentList = new LinkedList<>(); |
| | | List<ComponentApproving> existCAList = new LinkedList<>(); |
| | | List<Material> existMaterialList = new LinkedList<>(); |
| | | List<MaterialApproving> existCAList = new LinkedList<>(); |
| | | |
| | | List<Component> componentList = cService.getList(); |
| | | List<ComponentApproving> cAList = cApprovingService.getListByStatus(1); |
| | | List<Material> MaterialList = cService.getList(); |
| | | List<MaterialApproving> cAList = cApprovingService.getListByStatus(1); |
| | | for (int i = 0; i < cApprovingList.size(); i++) { |
| | | ComponentApproving componentApproving = cApprovingList.get(i); |
| | | for (int j = 0; j < componentList.size(); j++) { |
| | | if (componentApproving.getSubCode().equals(componentList.get(j).getSubCode()) |
| | | && componentApproving.getSubName().equals(componentList.get(j).getSubName()) |
| | | && componentApproving.getSubModel().equals(componentList.get(j).getSubModel()) |
| | | MaterialApproving MaterialApproving = cApprovingList.get(i); |
| | | for (int j = 0; j < MaterialList.size(); j++) { |
| | | if (MaterialApproving.getSubCode().equals(MaterialList.get(j).getSubCode()) |
| | | && MaterialApproving.getSubName().equals(MaterialList.get(j).getSubName()) |
| | | && MaterialApproving.getSubModel().equals(MaterialList.get(j).getSubModel()) |
| | | ) { |
| | | existComponentList.add(componentList.get(j)); |
| | | existMaterialList.add(MaterialList.get(j)); |
| | | } |
| | | } |
| | | |
| | | for (int j = 0; j < cAList.size(); j++) { |
| | | if (componentApproving.getSubCode().equals(cAList.get(j).getSubCode()) |
| | | && componentApproving.getSubName().equals(cAList.get(j).getSubName()) |
| | | && componentApproving.getSubModel().equals(cAList.get(j).getSubModel()) |
| | | if (MaterialApproving.getSubCode().equals(cAList.get(j).getSubCode()) |
| | | && MaterialApproving.getSubName().equals(cAList.get(j).getSubName()) |
| | | && MaterialApproving.getSubModel().equals(cAList.get(j).getSubModel()) |
| | | ) { |
| | | existCAList.add(cAList.get(j)); |
| | | } |
| | |
| | | } |
| | | |
| | | int existCASize = existCAList.size(); |
| | | int existComponentSize = existComponentList.size(); |
| | | int existMaterialSize = existMaterialList.size(); |
| | | if (existCASize != 0) { |
| | | if (existComponentSize != 0) { |
| | | response.setII(21, existCAList, existComponentList, "重复提交:现有散装件及正在进行审批的散装件中,存在当前提交上传的散装件"); |
| | | if (existMaterialSize != 0) { |
| | | response.setII(21, existCAList, existMaterialList, "重复提交:现有散装件及正在进行审批的散装件中,存在当前提交上传的散装件"); |
| | | } else { |
| | | response.set(22, existCAList, "重复提交:正在进行审批的散装件中,存在当前提交上传的散装件"); |
| | | } |
| | | return response; |
| | | } else { |
| | | if (existComponentSize != 0) { |
| | | return response.setII(23, null, existComponentList, "重复提交:现有散装件中,存在当前提交上传的散装件"); |
| | | if (existMaterialSize != 0) { |
| | | return response.setII(23, null, existMaterialList, "重复提交:现有散装件中,存在当前提交上传的散装件"); |
| | | } |
| | | } |
| | | }else{ //删除 |
| | | //判断是否在散装件审批删除中,是否存在产品关联及关联审批 |
| | | ComponentApproving deleteApproving = new ComponentApproving(); |
| | | List<ComponentProductHistory> existComponentProducts = new LinkedList<>(); |
| | | List<ComponentProductApproving> existComponentProductApprovingList = new LinkedList<>(); |
| | | deleteApproving = cApprovingService.getListByComponentId(cApprovingList.get(0).getComponentId()); |
| | | MaterialApproving deleteApproving = new MaterialApproving(); |
| | | List<MaterialProductHistory> existMaterialProducts = new LinkedList<>(); |
| | | List<MaterialProductApproving> existMaterialProductApprovingList = new LinkedList<>(); |
| | | deleteApproving = cApprovingService.getListByMaterialId(cApprovingList.get(0).getMaterialId()); |
| | | |
| | | //查看产品关联 |
| | | List<ComponentProductHistory> cphLatestExistList = cphService.getLatestExistListByComponentId(cApprovingList.get(0).getComponentId()); |
| | | List<MaterialProductHistory> cphLatestExistList = cphService.getLatestExistListByMaterialId(cApprovingList.get(0).getMaterialId()); |
| | | //查看产品关联审批 |
| | | List<ComponentProductApproving> cpaLatestExistList = cpApprovingService.getLatestExistListByComponentId(cApprovingList.get(0).getComponentId()); |
| | | |
| | | //lxw注释 |
| | | //List<MaterialProductApproving> cpaLatestExistList = cpApprovingService.getLatestExistListByMaterialId(cApprovingList.get(0).getMaterialId()); |
| | | List<MaterialProductApproving> cpaLatestExistList =new ArrayList<>(); |
| | | if(deleteApproving!=null){ |
| | | return response.set(31,deleteApproving,"拒绝本次删除申请,当前散装件正在进行删除审批"); |
| | | } |
| | |
| | | } |
| | | |
| | | } |
| | | main.setType(EnumWorksheetType.Component.getType()); |
| | | main.setType(EnumWorksheetType.Material.getType()); |
| | | //提交主表 |
| | | main.setCreateUserId(user.getId()); |
| | | //提交人角色来判断工作流层级 |
| | |
| | | return response.set(1); |
| | | } |
| | | |
| | | public Response productSoftwareSubmit(WorksheetMainDTO2 mainDTO, DocUser user) throws IOException { |
| | | public Response productSoftwareSubmit(MultipartFile file, WorksheetMainDTO2 mainDTO, DocUser user) throws IOException { |
| | | Response response = new Response(); |
| | | |
| | | WorksheetMain main = mainDTO.getMain(); |
| | | ProductSoftwareApproving approving = mainDTO.getApproving(); |
| | | MultipartFile file = mainDTO.getFile(); |
| | | |
| | | main.setType(1); |
| | | //提交主表 |
| | |
| | | Integer type = getInfoById(id).getType(); |
| | | if(type.intValue() == EnumWorksheetType.ProductBom.getType()) { |
| | | return mainMapper.getLinkList(id); |
| | | }else if(type.intValue() == EnumWorksheetType.Component.getType()){ |
| | | return mainMapper.getLinkListWithComponents(id); |
| | | }else if(type.intValue() == EnumWorksheetType.Material.getType()){ |
| | | //lxw注释 |
| | | //return mainMapper.getLinkListWithMaterials(id); |
| | | return null; |
| | | }else{ //散装件-产品 |
| | | return mainMapper.getLinkListWithComponentProducts(id); |
| | | //return mainMapper.getLinkListWithMaterialProducts(id); |
| | | return null; |
| | | } |
| | | } |
| | | |