| | |
| | | import com.whyc.dto.MaterialCheckDTO; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.MaterialMapper; |
| | | import com.whyc.pojo.DocUser; |
| | | import com.whyc.pojo.Material; |
| | | import com.whyc.pojo.MaterialHistory; |
| | | import com.whyc.pojo.ProductBom; |
| | | import com.whyc.pojo.*; |
| | | import com.whyc.util.DateUtil; |
| | | import com.whyc.util.*; |
| | | import org.apache.commons.codec.binary.Base64; |
| | |
| | | |
| | | @Autowired |
| | | private MaterialHistoryService mhService; |
| | | |
| | | @Autowired |
| | | private AttachLockService attachLockService; |
| | | |
| | | //查询所有的散装件信息加设置了替换关系的子件信息 |
| | | /*public Response getAllMaterial(String category,String subCode,String subName,String subModel,int pageCurr,int pageSize) { |
| | |
| | | |
| | | /** |
| | | * 转移 被复制的附件,到新的物料 |
| | | * @param fileUrlDir 被复制的附件路径,例如:doc_file\material\8468-0109000512-SHIDA-2455-OLD-ZX_A01 |
| | | * @param materialDB .fileUrl 被复制的附件路径,例如:doc_file\material\8468-0109000512-SHIDA-2455-OLD-ZX_A01 |
| | | * @param material 新的物料 |
| | | * @return 返回被追加文件的文件夹路径 |
| | | */ |
| | | @Transactional |
| | | public Response transferCopiedAttachment(String fileUrlDir, Material material) throws IOException { |
| | | public Response transferCopiedAttachment(Material materialDB, Material material) throws IOException { |
| | | String fileUrlDir = materialDB.getFileUrl(); |
| | | String subModel = material.getSubModel(); |
| | | subModel = MaterialSpecialCharUtil.transfer(subModel); |
| | | String dirPathDB = "doc_file" + File.separator + "material" + File.separator + material.getId() + "-"+ material.getSubCode() + "-" + subModel; |
| | | String dirPath = CommonUtil.getRootFile() + "material" + File.separator + material.getId() + "-"+ material.getSubCode() + "-" + subModel; |
| | | File dirFile = new File(dirPath); |
| | | |
| | | boolean dirFileExist = true; |
| | | if(!dirFile.exists()){ |
| | | |
| | | dirFile.mkdirs(); |
| | | dirFileExist = false; |
| | | } |
| | | FileUtil.copyDirectory(new File(CommonUtil.getProjectDir() + File.separator + fileUrlDir),dirFile); |
| | | |
| | | if(!dirFileExist){ |
| | | //路径不存在,说明是首次上传,设置物料对应的fileUrl |
| | | //设置物料对应的fileUrl及物料状态 |
| | | Material temp = new Material(); |
| | | temp.setId(material.getId()); |
| | | temp.setFileUrl(dirPathDB); |
| | | mapper.updateById(temp); |
| | | } |
| | | |
| | | attachLockService.getAndInsert(materialDB.getId(),material.getId()); |
| | | |
| | | |
| | | return new Response().set(1,true,"上传完成"); |
| | | } |