From 0871a25215fb468f121785600f796a14b54d8ebc Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期五, 06 六月 2025 15:47:00 +0800 Subject: [PATCH] 1.刀具添加字段 2.新增dnc传输日志表 3.导入NC文件默认产生nc文件对应数控程序加工确认表 4.拆分两网 修改yml配置 --- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java | 74 +++++++++++++++++++++++++++++-------- 1 files changed, 58 insertions(+), 16 deletions(-) diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java index fdf2f26..d6de4b9 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java @@ -1,5 +1,6 @@ package org.jeecg.modules.dnc.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -63,6 +64,12 @@ private IDispatchFileService dispatchFileService; @Autowired private ISysParamsService sysParamsService; + @Autowired + @Lazy + private IComponentInfoService componentInfoService; + @Autowired + @Lazy + private IGuideCardBatchService guideCardBatchService; /*澶囦唤澶勭悊*/ @Override @@ -99,6 +106,19 @@ docRelative.setAttributionType(uploadRequest.getAttributionType()); docRelative.setClassificationId(docClass.getClassificationId()); boolean b = docRelativeService.save(docRelative); + if (uploadRequest.getAttributionType()==2){ + //鏌ヨ鍊熺敤鐨勯儴浠� + List<ComponentInfo> borrowComponentInfoList=componentInfoService.list(new QueryWrapper<ComponentInfo>().eq("borrow_id", uploadRequest.getAttributionId())); + if (!borrowComponentInfoList.isEmpty()) { + borrowComponentInfoList.forEach(item->{ + DocRelative borrowDocRelative = new DocRelative(); + BeanUtil.copyProperties(docRelative,borrowDocRelative); + borrowDocRelative.setAttributionId(item.getComponentId()); + borrowDocRelative.setId(null); + docRelativeService.save(borrowDocRelative); + }); + } + } if(!b) ExceptionCast.cast(DocumentCode.DOC_UPLOAD_ERROR); DocFile docFile = new DocFile(); @@ -142,19 +162,27 @@ } } boolean saveBool = super.save(docInfo); - SysParams sysParams=sysParamsService.getSysPramBySettingKey("nc_dispatch_file"); - if (sysParams ==null){ - throw new JeecgBootException("鏈厤缃鍏C涓庣數瀛愬浘鐗堟槸鍚﹁Е鍙戝绛炬祦绋嬶紝璇疯仈绯荤鐞嗗憳"); - }else { - if (saveBool&&sysParams.getSettingValue().equals("1")){ - //瑙﹀彂瀹$ - DispatchFile dispatchFile = new DispatchFile(); - dispatchFile.setDocId(docInfo.getDocId()); - dispatchFile.setFileId(docFile.getFileId()); - dispatchFile.setAttributionId(uploadRequest.getAttributionId()); - dispatchFile.setAttributionType(String.valueOf(uploadRequest.getAttributionType())); - dispatchFile.setDocClassCode(uploadRequest.getDocClassCode()); - dispatchFileService.saveDispatchFile(dispatchFile); + if (uploadRequest.getDocClassCode().equals("NC")||uploadRequest.getDocClassCode().equals("other")){ + SysParams sysParams=sysParamsService.getSysPramBySettingKey("nc_dispatch_file"); + if (sysParams ==null){ + throw new JeecgBootException("鏈厤缃鍏C涓庣數瀛愬浘鐗堟槸鍚﹁Е鍙戝绛炬祦绋嬶紝璇疯仈绯荤鐞嗗憳"); + }else { + if (saveBool&&sysParams.getSettingValue().equals("1")){ + //瑙﹀彂瀹$ + DispatchFile dispatchFile = new DispatchFile(); + dispatchFile.setDocId(docInfo.getDocId()); + dispatchFile.setFileId(docFile.getFileId()); + dispatchFile.setAttributionId(uploadRequest.getAttributionId()); + dispatchFile.setAttributionType(String.valueOf(uploadRequest.getAttributionType())); + dispatchFile.setDocClassCode(uploadRequest.getDocClassCode()); + dispatchFileService.saveDispatchFile(dispatchFile); + } + } + } + if (uploadRequest.getDocClassCode().equals("NC")){ + boolean savaGuideCardBatch=guideCardBatchService.importGuideCardBatch(docInfo.getDocId(),uploadRequest.getAttributionId(),uploadRequest.getAttributionType()); + if (!savaGuideCardBatch) { + ExceptionCast.cast(DocumentCode.DOC_BATCH_ERROR); } } return saveBool; @@ -318,7 +346,7 @@ @Override @Transactional(rollbackFor = {Exception.class}) - public boolean deleteDocInfo(String id) { + public boolean deleteDocInfo(String id,String attrType,String attrId) { if(!ValidateUtil.validateString(id)) ExceptionCast.cast(CommonCode.INVALID_PARAM); DocInfo en = super.getById(id); @@ -326,6 +354,20 @@ ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); if(en.getDocStatus() != 1) ExceptionCast.cast(DocumentCode.DOC_DEL_ERROR); + //鏌ヨ瀵瑰簲鐨勫叧绯� + if ("2".equals(attrType)) { + //鍒ゆ柇閮ㄤ欢寮曠敤 + ComponentInfo componentInfo=componentInfoService.getById(attrId); + if(componentInfo!=null&&componentInfo.getBorrowId()!=null){ + //鍊熺敤鐨勯儴浠讹紝鍙垹闄よ嚜宸辩殑鍏崇郴 + DocRelative docRelative=docRelativeService.getOne(new QueryWrapper<DocRelative>() + .eq("attribution_id", attrId).eq("attribution_type", 2).eq("doc_id",id)); + if(docRelative!=null){ + docRelativeService.removeById(docRelative.getId()); + return true; + } + } + } FileOperate operate = fileOperateService.getByDocId(id); if(operate != null) ExceptionCast.cast(DocumentCode.DOC_IS_OPERATING); @@ -896,11 +938,11 @@ @Override @Transactional(rollbackFor = {Exception.class}) - public boolean batchRemoveDocInfo(String[] docIds) { + public boolean batchRemoveDocInfo(String[] docIds,String attrType,String attrId) { if(docIds == null || docIds.length < 1) ExceptionCast.cast(CommonCode.INVALID_PARAM); for(String docId : docIds) { - this.deleteDocInfo(docId); + this.deleteDocInfo(docId,attrType,attrId); } return true; } -- Gitblit v1.9.3