src/main/java/com/whyc/controller/WorksheetMainController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/pojo/Material.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/pojo/WorksheetMain.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/WorksheetLinkService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/WorksheetMainService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/controller/WorksheetMainController.java
@@ -40,9 +40,9 @@ } } @PostMapping("MaterialRelatedSubmit") @ApiOperation(value="散装件-产品审批提交") public Response MaterialProductSubmit(@RequestBody WorksheetMainDTO mainDTO){ @PostMapping("materialRelatedSubmit") @ApiOperation(value="物料-产品审批提交") public Response materialProductSubmit(@RequestBody WorksheetMainDTO mainDTO){ DocUser user = ActionUtil.getUser(); boolean res = service.MaterialProductSubmit(mainDTO,user); if(res) { @@ -52,12 +52,12 @@ } } @PostMapping("MaterialSubmit") @ApiOperation(value="散装件审批提交") public Response MaterialSubmit(@RequestBody WorksheetMain main){ @PostMapping("materialSubmit") @ApiOperation(value="物料审批提交") public Response materialSubmit(@RequestBody WorksheetMain main){ Response<Object> response = new Response<>(); DocUser user = ActionUtil.getUser(); Response res = service.MaterialSubmit(main,user); Response res = service.materialSubmit(main,user); if(res.getCode()==1) { response.set(1,true, "提交完成"); }else if(res.getCode()==3){ @@ -71,11 +71,11 @@ response.setData2(existCAList); response.setData3(existMaterialList); if(res.getCode()==21){ response.setMsg("重复提交:现有散装件及正在进行审批的散装件中,存在当前提交上传的散装件"); response.setMsg("重复提交:现有物料及正在进行审批的物料中,存在当前提交上传的散装件"); }else if(res.getCode()==22){ response.setMsg("重复提交:正在进行审批的散装件中,存在当前提交上传的散装件"); response.setMsg("重复提交:正在进行审批的物料中,存在当前提交上传的物料"); }else{ response.setMsg("重复提交:现有散装件中,存在当前提交上传的散装件"); response.setMsg("重复提交:现有物料中,存在当前提交上传的物料"); } } return response; src/main/java/com/whyc/pojo/Material.java
@@ -10,7 +10,7 @@ import java.util.List; /** * 散装件 * 物料 */ @TableName(schema = "db_doc",value = "tb_material") @Alias("Material") src/main/java/com/whyc/pojo/WorksheetMain.java
@@ -68,12 +68,12 @@ @TableField(exist = false) private DocUser approvingUser; @ApiModelProperty("待审批散装件") @ApiModelProperty("待审批物料") @TableField(exist = false) private List<MaterialApproving> cApprovingList; private List<MaterialApproving> mApprovingList; @TableField(exist = false) private List<MaterialProductApproving> cpApprovingList; private List<MaterialProductApproving> mpApprovingList; public Integer getId() { return id; @@ -211,19 +211,19 @@ this.type = type; } public List<MaterialApproving> getCApprovingList() { return cApprovingList; public List<MaterialApproving> getMApprovingList() { return mApprovingList; } public void setCApprovingList(List<MaterialApproving> cApprovingList) { this.cApprovingList = cApprovingList; public void setMApprovingList(List<MaterialApproving> mApprovingList) { this.mApprovingList = mApprovingList; } public List<MaterialProductApproving> getCpApprovingList() { return cpApprovingList; public List<MaterialProductApproving> getMpApprovingList() { return mpApprovingList; } public void setCpApprovingList(List<MaterialProductApproving> cpApprovingList) { this.cpApprovingList = cpApprovingList; public void setMpApprovingList(List<MaterialProductApproving> mpApprovingList) { this.mpApprovingList = mpApprovingList; } } src/main/java/com/whyc/service/WorksheetLinkService.java
@@ -43,10 +43,10 @@ private MaterialProductApprovingService cpAService; @Autowired private MaterialApprovingService cAService; private MaterialApprovingService mAService; @Autowired private MaterialService cService; private MaterialService mService; @Autowired private ProductSoftwareApprovingService productSoftwareApprovingService; @@ -60,9 +60,9 @@ //更新节点信息 linkMapper.updateById(link); if(link.getLinkStatus() == 2){ //驳回 //查看是否为散装件审批,是则需要更新散装件审批表中的状态为完结 //查看是否为物料审批,是则需要更新物料审批表中的状态为完结 if(mainService.getInfoById(link.getMainId()).getType().equals(EnumWorksheetType.Material.getType())){ cAService.endStatus(link.getMainId()); mAService.endStatus(link.getMainId()); } //项目经理驳回,驳回即终止 mainService.updateEndStatusById(link.getMainId(),"经理驳回,驳回原因:"+link.getDealReason(),0); @@ -250,37 +250,37 @@ //更新正式bom的对应url bomService.updateUrl(fileBomApprovingList); } else if(type.intValue() == EnumWorksheetType.Material.getType()){ //散装件 List<MaterialApproving> approvingList = cAService.getListByMainId(link.getMainId()); else if(type.intValue() == EnumWorksheetType.Material.getType()){ //物料 List<MaterialApproving> approvingList = mAService.getListByMainId(link.getMainId()); List<Material> MaterialList = new LinkedList<>(); //区分是新增还是删除 Integer MaterialId = approvingList.get(0).getMaterialId(); if(MaterialId==null) { //新增 //将散装件从审批表中转移到正式表 //将物料从审批表中转移到正式表 approvingList.forEach(approve -> { Material Material = new Material(); Material.setCategory(approve.getCategory()); Material.setSubCode(approve.getSubCode()); Material.setSubName(approve.getSubName()); Material.setSubModel(approve.getSubModel()); Material.setUnit(approve.getUnit()); Material.setQuantity(approve.getQuantity()); Material.setProducer(approve.getProducer()); Material.setNotes(approve.getNotes()); Material.setCreateDate(new Date()); Material.setStatus(1); MaterialList.add(Material); Material material = new Material(); material.setCategory(approve.getCategory()); material.setSubCode(approve.getSubCode()); material.setSubName(approve.getSubName()); material.setSubModel(approve.getSubModel()); material.setUnit(approve.getUnit()); material.setQuantity(approve.getQuantity()); material.setProducer(approve.getProducer()); material.setNotes(approve.getNotes()); material.setCreateDate(new Date()); material.setStatus(1); MaterialList.add(material); }); cService.insertBatch(MaterialList); mService.insertBatch(MaterialList); }else{ //删除 List<Integer> MaterialIdList = approvingList.stream().map(MaterialApproving::getMaterialId).collect(Collectors.toList()); cService.deleteBatch(MaterialIdList); mService.deleteBatch(MaterialIdList); } //更新散装件审批子表中type为完结 cAService.endStatus(link.getMainId()); //更新物料审批子表中type为完结 mAService.endStatus(link.getMainId()); } else if(type.intValue() == EnumWorksheetType.MaterialProduct.getType()){ //更新散装件-产品关系 //查找到对应的散装件-产品关系数据 else if(type.intValue() == EnumWorksheetType.MaterialProduct.getType()){ //更新物料-产品关系 //查找到对应的物料-产品关系数据 List<MaterialProductApproving> cpAList = cpAService.getListByMainId(link.getMainId()); //查询部件最新的版本号 //lxw修改 @@ -307,7 +307,7 @@ } }); List<MaterialProductHistory> newHistoryList = new LinkedList<>(); //查询最新版本生效的相关散装件 //查询最新版本生效的相关物料 //lxw注释 //List<MaterialProductHistory> nowHistoryList = cphService.getListByParentModel(cpAList.get(0).getParentModel(), currentVersion); List<MaterialProductHistory> nowHistoryList =new ArrayList<>(); @@ -316,16 +316,16 @@ List<ProductBomHistory> nowBomHistoryList = new ArrayList<>(); /* 对于关联的,判断当前版本中是否存在替换关系,存在,则直接下个版本插入关联; 同时,其他当前版本的相关散装件-产品记录更新版本,排除存在的替换关系 同时,其他当前版本的相关物料-产品记录更新版本,排除存在的替换关系 */ /* 对于替换的,判断当前版本中是否存在关联关系,存在,直接下个版本替换,记录插入; 同时,当前版本的相关散装件-产品记录更新版本,排除存在的关联关系; 同时,当前版本的相关物料-产品记录更新版本,排除存在的关联关系; 同时,bom表更新到下个版本时,排除被替换件 */ //对于解除关联的,当前版本的相关散装件-产品记录更新版本,排除解除关联的记录 //对于解除关联的,当前版本的相关物料-产品记录更新版本,排除解除关联的记录 //处理思路:先解除关联,再替换,再关联 if(removedList.size()!=0){ removedList.forEach(remove -> { @@ -351,7 +351,7 @@ //处理替换 if(replacedList.size()!=0){ replacedList.forEach(replace -> { //当前生效的散装件-产品列表 //当前生效的物料-产品列表 /*nowHistoryList.forEach(nowHistory -> { if (replace.getMaterialId().intValue() == nowHistory.getMaterialId()) { nowHistoryList.remove(nowHistory); @@ -370,7 +370,7 @@ }*/ } } //下个版本新增替换的散装件-产品列表 //下个版本新增替换的物料-产品列表 MaterialProductHistory newHistory = new MaterialProductHistory(); newHistory.setMaterialId(replace.getMaterialId()); //lxw注释 src/main/java/com/whyc/service/WorksheetMainService.java
@@ -51,10 +51,10 @@ private MaterialProductApprovingService cpApprovingService; @Autowired private MaterialApprovingService cApprovingService; private MaterialApprovingService mApprovingService; @Autowired private MaterialService cService; private MaterialService mService; @Autowired private ProductBomService pbService; @@ -204,7 +204,7 @@ }else{ return false; } //散装件-产品审批提交 //物料-产品审批提交 if(addedList!=null && addedList.size()!=0){ addedList.forEach(item->{ item.setMainId(main.getId()); @@ -230,33 +230,33 @@ return true; } public Response MaterialSubmit(WorksheetMain main, DocUser user) { public Response materialSubmit(WorksheetMain main, DocUser user) { Response<Object> response = new Response<>(); List<MaterialApproving> cApprovingList = main.getCApprovingList(); List<MaterialApproving> mApprovingList = main.getMApprovingList(); //判断是新增还是删除 boolean isAdded = cApprovingList.get(0).getSubName()!=null; boolean isAdded = mApprovingList.get(0).getSubName()!=null; if(isAdded) { //新增 //查询是否有 已生效或者已提交审批的 相同的散装件 //查询是否有 已生效或者已提交审批的 相同的物料 List<Material> existMaterialList = new LinkedList<>(); List<MaterialApproving> existCAList = new LinkedList<>(); List<Material> MaterialList = cService.getList(); List<MaterialApproving> cAList = cApprovingService.getListByStatus(1); for (int i = 0; i < cApprovingList.size(); i++) { 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()) List<Material> materialList = mService.getList(); List<MaterialApproving> cAList = mApprovingService.getListByStatus(1); for (int i = 0; i < mApprovingList.size(); i++) { MaterialApproving materialApproving = mApprovingList.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()) ) { existMaterialList.add(MaterialList.get(j)); existMaterialList.add(materialList.get(j)); } } for (int j = 0; j < cAList.size(); j++) { if (MaterialApproving.getSubCode().equals(cAList.get(j).getSubCode()) && MaterialApproving.getSubName().equals(cAList.get(j).getSubName()) && MaterialApproving.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)); } @@ -267,41 +267,39 @@ int existMaterialSize = existMaterialList.size(); if (existCASize != 0) { if (existMaterialSize != 0) { response.setII(21, existCAList, existMaterialList, "重复提交:现有散装件及正在进行审批的散装件中,存在当前提交上传的散装件"); response.setII(21, existCAList, existMaterialList, "重复提交:现有物料及正在进行审批的物料中,存在当前提交上传的物料"); } else { response.set(22, existCAList, "重复提交:正在进行审批的散装件中,存在当前提交上传的散装件"); response.set(22, existCAList, "重复提交:正在进行审批的物料中,存在当前提交上传的物料"); } return response; } else { if (existMaterialSize != 0) { return response.setII(23, null, existMaterialList, "重复提交:现有散装件中,存在当前提交上传的散装件"); return response.setII(23, null, existMaterialList, "重复提交:现有物料中,存在当前提交上传的物料"); } } }else{ //删除 //判断是否在散装件审批删除中,是否存在产品关联及关联审批 //判断是否在物料审批删除中,是否存在产品关联及关联审批 MaterialApproving deleteApproving = new MaterialApproving(); List<MaterialProductHistory> existMaterialProducts = new LinkedList<>(); List<MaterialProductApproving> existMaterialProductApprovingList = new LinkedList<>(); deleteApproving = cApprovingService.getListByMaterialId(cApprovingList.get(0).getMaterialId()); deleteApproving = mApprovingService.getListByMaterialId(mApprovingList.get(0).getMaterialId()); //查看产品关联 List<MaterialProductHistory> cphLatestExistList = cphService.getLatestExistListByMaterialId(cApprovingList.get(0).getMaterialId()); List<MaterialProductHistory> cphLatestExistList = cphService.getLatestExistListByMaterialId(mApprovingList.get(0).getMaterialId()); //查看产品关联审批 //lxw注释 //List<MaterialProductApproving> cpaLatestExistList = cpApprovingService.getLatestExistListByMaterialId(cApprovingList.get(0).getMaterialId()); List<MaterialProductApproving> cpaLatestExistList =new ArrayList<>(); List<MaterialProductApproving> cpaLatestExistList = cpApprovingService.getLatestExistListByMaterialId(mApprovingList.get(0).getMaterialId()); if(deleteApproving!=null){ return response.set(31,deleteApproving,"拒绝本次删除申请,当前散装件正在进行删除审批"); return response.set(31,deleteApproving,"拒绝本次删除申请,当前物料正在进行删除审批"); } if(cphLatestExistList!=null && cphLatestExistList.size()!=0){ if(cpaLatestExistList!=null && cpaLatestExistList.size()!=0){ return response.setII(32,cpaLatestExistList,cphLatestExistList,"拒绝本次删除申请,当前散装已经关联产品及在产品关联审批"); }else{ return response.setII(33,null,cphLatestExistList,"拒绝本次删除申请,当前散装件在产品关联审批"); return response.setII(33,null,cphLatestExistList,"拒绝本次删除申请,当前物料在产品关联审批"); } }else{ if(cpaLatestExistList!=null && cpaLatestExistList.size()!=0){ return response.set(34,cpaLatestExistList,"拒绝本次删除申请,当前散装件已经关联产品"); return response.set(34,cpaLatestExistList,"拒绝本次删除申请,当前物料已经关联产品"); } } @@ -351,14 +349,14 @@ }else{ return response.set(3); } //散装件-审批提交 cApprovingList.forEach(cApproving->{ //物料-审批提交 mApprovingList.forEach(cApproving->{ cApproving.setCreateDate(new Date()); cApproving.setMainId(main.getId()); cApproving.setStatus(1); }); cApprovingService.insert(cApprovingList); mApprovingService.insert(mApprovingList); return response.set(1); } @@ -613,7 +611,7 @@ //lxw注释 //return mainMapper.getLinkListWithMaterials(id); return null; }else{ //散装件-产品 }else{ //物料-产品 //return mainMapper.getLinkListWithMaterialProducts(id); return null; }