| | |
| | | import org.flowable.task.api.Task; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.dnc.constant.DncPassLogPassType; |
| | | import org.jeecg.modules.dnc.constant.DocAttributionTypeEnum; |
| | | import org.jeecg.modules.dnc.dto.TransferPackage; |
| | | import org.jeecg.modules.dnc.entity.*; |
| | | import org.jeecg.modules.dnc.exception.ExceptionCast; |
| | | import org.jeecg.modules.dnc.ext.NcTxtFilePathInfo; |
| | | import org.jeecg.modules.dnc.response.*; |
| | | import org.jeecg.modules.dnc.service.*; |
| | | import org.jeecg.modules.dnc.service.impl.FileFerryService; |
| | | import org.jeecg.modules.dnc.utils.ValidateUtil; |
| | | import org.jeecg.modules.dnc.utils.date.DateUtil; |
| | | import org.jeecg.modules.dnc.utils.file.FileUtilS; |
| | | import org.jeecg.modules.dncFlow.entity.AssignFileStream; |
| | | import org.jeecg.modules.dncFlow.entity.ToEquipmentTask; |
| | | import org.jeecg.modules.dncFlow.ext.AssignFileStreamExt; |
| | | import org.jeecg.modules.dncFlow.mapper.AssignFileStreamMapper; |
| | | import org.jeecg.modules.dncFlow.request.ApproveBatchRequest; |
| | |
| | | import org.jeecg.modules.dncFlow.request.AssignFileStreamQueryRequest; |
| | | import org.jeecg.modules.dncFlow.request.TaskRequest; |
| | | import org.jeecg.modules.dncFlow.service.IAssignFileStreamService; |
| | | import org.jeecg.modules.dncFlow.service.IToEquipmentTaskService; |
| | | import org.jeecg.modules.dncFlow.vo.AssignFlowTaskVo; |
| | | import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; |
| | | import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService; |
| | |
| | | import org.jeecg.modules.flowable.service.IFlowTaskService; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service("IAssignFileStreamService") |
| | | public class AssignFileStreamServiceImpl extends ServiceImpl<AssignFileStreamMapper, AssignFileStream> implements IAssignFileStreamService , FlowCallBackServiceI { |
| | | private static final String PROCESS_KEY = "assign_nc_to_device"; |
| | | private static final String APPLY_VARIABLE = "apply_user"; |
| | | private static final String APPROVE_VARIABLE = "approve_users"; |
| | | private static final String SEND_CODE = "SEND"; |
| | | |
| | | @Value("${flowable.enable}") |
| | | private Boolean flowableEnable; |
| | | |
| | | @Value("${fileHomePath}") |
| | | private String fileHomePath; |
| | | @Autowired |
| | | private IDocInfoService docInfoService; |
| | | @Autowired |
| | | private IProcessStreamService processStreamService; |
| | | @Autowired |
| | | private IWorkStepService workStepService; |
| | | @Autowired |
| | | private IPermissionStreamNewService permissionStreamNewService; |
| | | @Autowired |
| | | private IDocClassificationService classificationService; |
| | | @Autowired |
| | | private IToEquipmentTaskService equipmentTaskService; |
| | | @Autowired |
| | | private IDeviceInfoService deviceInfoService; |
| | | @Autowired |
| | | private IDocFileService docFileService; |
| | | @Autowired |
| | |
| | | @Autowired |
| | | private IFlowTaskService flowTaskService; |
| | | @Autowired |
| | | private IDeviceTypeService deviceTypeService; |
| | | @Autowired |
| | | private IFlowMyBusinessService flowMyBusinessService; |
| | | |
| | | @Value("${securedoc.whether}") |
| | | private String whether; |
| | | @Value("${securedoc.localFilePath}") |
| | | private String localFilePath; |
| | | |
| | | @Autowired |
| | | private PermissionService permissionService; |
| | | @Autowired |
| | | private IDncPassLogService dncPassLogService; |
| | | @Value("${deploy.secretFolder}") |
| | | private String secretFolder; //涉密网传输nc文件夹 |
| | | @Autowired |
| | | private FileFerryService ferryService; |
| | | @Autowired |
| | | private IDocClassificationService iDocClassificationService; |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result applyAssignFile(AssignFileStream stream) { |
| | | public Result<?> applyAssignFile(AssignFileStream stream) { |
| | | synchronized (this){ |
| | | //判断设备特殊字符 |
| | | String specialChar = getDeviceSpecialChar(stream.getDeviceId(),stream.getFileId()); |
| | | if (StrUtil.isNotEmpty(specialChar)){ |
| | | //抛出特殊字符异常 |
| | | return Result.error("文件名称存在设备特殊字符"); |
| | | } |
| | | //查询文档的状态,批准状态才可以指派 |
| | | DocInfo docInfo=getDocInfo(stream); |
| | | DocClassification docClassification=iDocClassificationService.getById(docInfo.getClassificationId()); |
| | | if (docInfo.getDocDispatchStatus()!=null&&docInfo.getDocDispatchStatus()!=3&&docClassification.getClassificationCode().equals("nc")){ |
| | | return Result.error("该文件状态不允许指派,请先完成审签流程"); |
| | | } |
| | | if(flowableEnable) { |
| | | return applyAssignFileActive(stream); |
| | |
| | | */ |
| | | public String getDeviceSpecialChar(String deviceId, String fileId){ |
| | | //替换为mdc设备表 |
| | | // DeviceInfo deviceInfo = deviceInfoService.getById(deviceId); |
| | | MdcEquipment mdcEquipment = iMdcEquipmentService.getById(deviceId); |
| | | if(mdcEquipment == null) |
| | | ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); |
| | |
| | | //权限校验 |
| | | validateParams(stream); |
| | | DocInfo docInfo = getDocInfo(stream); |
| | | //修改原有状态 |
| | | docInfo.setDocDispatchStatus(4); |
| | | docInfoService.updateById(docInfo); |
| | | MdcEquipment mdcEquipment = getMdcEquipment(stream); |
| | | DocFile docFile = getDocFile(stream); |
| | | DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 7, stream.getDeviceId()); |
| | |
| | | } |
| | | |
| | | } |
| | | List<DocRelative> docRelativeList=docRelativeService. |
| | | list(new QueryWrapper<DocRelative>() |
| | | .eq("attribution_type",stream.getAttributionType()) |
| | | .eq("attribution_id",stream.getAttributionId()) |
| | | .eq("doc_id",stream.getDocId())); |
| | | if (docRelativeList.isEmpty()){ |
| | | ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); |
| | | } |
| | | handleFileTransfer(mdcEquipment, docFile); |
| | | handleFileProcessing(docFile, mdcEquipment, whether, localFilePath); |
| | | //NC文件的拷贝 |
| | | handleFileProcessing(docFile, mdcEquipment, secretFolder); |
| | | //对应产品结构树拷贝 |
| | | handleProductTree(docInfo,docRelativeList.get(0),mdcEquipment.getEquipmentId()); |
| | | synchronizedFlagService.updateFlag(2); |
| | | return Result.OK("操作成功"); |
| | | } |
| | |
| | | if(!b) |
| | | ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); |
| | | if(up.getStatus() == 2) { |
| | | DocInfo docInfo; |
| | | //同意操作 |
| | | if (StrUtil.isNotEmpty(en.getStepId())){ |
| | | //工步下设备类指派 |
| | | docInfo = docInfoService.getByDocAttrAndDocId(en.getDocId(), 6, en.getDeviceTypeId()); |
| | | }else { |
| | | docInfo = docInfoService.getByDocAttrAndDocId(en.getDocId(), 5, en.getDeviceTypeId()); |
| | | } |
| | | if(docInfo == null || docInfo.getDocStatus() == 3) |
| | | ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR); |
| | | DocInfo docInfo = docInfoService.getByDocAttrAndDocId(en.getDocId(), Integer.valueOf(en.getAttributionType()), en.getAttributionId()); |
| | | if(docInfo == null ) |
| | | ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR); |
| | | MdcEquipment mdcEquipment = iMdcEquipmentService.getById(en.getDeviceId()); |
| | | if(mdcEquipment == null) |
| | | ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); |
| | | DocFile docFile = docFileService.getById(en.getFileId()); |
| | | if(docFile == null) |
| | | ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); |
| | | //修改原有状态 |
| | | docInfo.setDocDispatchStatus(4); |
| | | docInfoService.updateById(docInfo); |
| | | DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(en.getDocId(),7, en.getDeviceId()); |
| | | if(deviceDoc != null) { |
| | | // 删除 备份 覆盖 原有的 |
| | |
| | | } |
| | | } |
| | | } |
| | | List<DocRelative> docRelativeList=docRelativeService. |
| | | list(new QueryWrapper<DocRelative>() |
| | | .eq("attribution_type",en.getAttributionType()) |
| | | .eq("attribution_id",en.getAttributionId()) |
| | | .eq("doc_id",en.getDocId())); |
| | | if (docRelativeList.isEmpty()){ |
| | | ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); |
| | | } |
| | | //涉密网进行NC文件的拷贝 |
| | | handleFileTransfer(mdcEquipment, docFile); |
| | | //NC文件的拷贝 |
| | | handleFileProcessing(docFile, mdcEquipment, secretFolder); |
| | | //对应产品结构树拷贝 |
| | | handleProductTree(docInfo,docRelativeList.get(0),mdcEquipment.getEquipmentId()); |
| | | return synchronizedFlagService.updateFlag(1); |
| | | }else if(up.getStatus() == 3) { |
| | | //拒绝操作 什么也不做 |
| | |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean transferDocFile(String pnCode, String deviceNo) { |
| | | List<ProcessStream> streams = processStreamService.validateDeviceProcessInfo(pnCode, deviceNo); |
| | | DeviceInfo deviceInfo = deviceInfoService.getByDeviceNo(deviceNo); |
| | | if(deviceInfo == null) |
| | | ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST); |
| | | //删除原来设备下的所有文档 |
| | | docRelativeService.deleteByDocAttr(7, deviceInfo.getDeviceId()); |
| | | List<DocInfo> docInfoList = docInfoService.getByProcessIds(streams); |
| | | if(docInfoList == null || docInfoList.isEmpty()) |
| | | ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | if(!ValidateUtil.validateString(userId)) |
| | | ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); |
| | | for(DocInfo docInfo : docInfoList) { |
| | | DocFile docFile = docFileService.getById(docInfo.getPublishFileId()); |
| | | if(docFile == null) |
| | | ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); |
| | | //插入文档到设备发送文档 |
| | | DocClassification classification = classificationService.getByCode(SEND_CODE); |
| | | if(classification == null) |
| | | ExceptionCast.cast(DocumentCode.DOC_CLASS_ERROR); |
| | | DocRelative docRelative = new DocRelative(); |
| | | docRelative.setDocId(docInfo.getDocId()); |
| | | docRelative.setClassificationId(classification.getClassificationId()); |
| | | docRelative.setAttributionType(7); |
| | | docRelative.setAttributionId(deviceInfo.getDeviceId()); |
| | | boolean b = docRelativeService.save(docRelative); |
| | | if(!b) |
| | | ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); |
| | | //插入文件传输任务表 |
| | | ToEquipmentTask equipmentTask = new ToEquipmentTask(); |
| | | //不能直接从doc中拿fileId 和version 可能会存在斌更 |
| | | //equipmentTask.setFileId(docInfo.getPublishFileId()); |
| | | //equipmentTask.setDocVersion(docInfo.getPublishVersion()); |
| | | equipmentTask.setDocId(docInfo.getDocId()); |
| | | equipmentTask.setSyncFlag(1); |
| | | equipmentTask.setDeviceNo(deviceInfo.getDeviceNo()); |
| | | equipmentTask.setDeviceId(deviceInfo.getDeviceId()); |
| | | equipmentTask.setDepartId(deviceInfo.getDepartId()); |
| | | //文件相关信息 |
| | | equipmentTask.setFileId(docFile.getFileId()); |
| | | equipmentTask.setDocVersion(docFile.getDocVersion()); |
| | | equipmentTask.setFileName(docInfo.getDocName()); |
| | | equipmentTask.setFileEncodeName(docFile.getFileEncodeName()); |
| | | equipmentTask.setFilePath(docFile.getFilePath()); |
| | | equipmentTask.setFileSuffix(docFile.getFileSuffix()); |
| | | equipmentTask.setFileSize(docFile.getFileSize()); |
| | | b = equipmentTaskService.save(equipmentTask); |
| | | if(!b) { |
| | | ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); |
| | | } |
| | | } |
| | | return synchronizedFlagService.updateFlag(1); |
| | | } |
| | | |
| | | //传参验证 |
| | | private void validateParams(AssignFileStream stream) { |
| | | if (stream == null) { |
| | |
| | | |
| | | //获取文件 |
| | | private void handleExistingDeviceDoc(DocFile docFile, MdcEquipment mdcEquipment, String deviceId) { |
| | | List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getEquipmentId()); |
| | | List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); |
| | | if (strings != null && !strings.isEmpty()) { |
| | | String path = StringUtils.join(strings.toArray(), "/"); |
| | | boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/" + mdcEquipment.getEquipmentId(), |
| | |
| | | } |
| | | |
| | | private PermissionStreamNew getPermissionStreams(AssignFileStream stream) { |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | DeviceType deviceType = deviceTypeService.getById(stream.getAttributionId()); |
| | | String attributionId = deviceType != null ? deviceType.getAttributionId() : stream.getAttributionId(); |
| | | |
| | | PermissionStreamNew permissionStreams; |
| | | if (stream.getAttributionType().equals("5")) { |
| | | // 工序 |
| | | permissionStreams = handleProcess(stream, attributionId, user); |
| | | } else { |
| | | // 工步 |
| | | permissionStreams = handleWorkStep(stream, attributionId, user); |
| | | } |
| | | if (permissionStreams == null) { |
| | | PermissionStreamNew permissionStreamNew = permissionService.getPermissionStreams(stream); |
| | | if (permissionStreamNew == null) { |
| | | ExceptionCast.cast(ActivitiCode.ACT_NODE_DEPART_NONE); |
| | | } |
| | | return permissionStreams; |
| | | return permissionStreamNew ; |
| | | } |
| | | |
| | | private PermissionStreamNew handleProcess(AssignFileStream stream, String attributionId, LoginUser user) { |
| | | ProcessStream processStream = processStreamService.getById(attributionId); |
| | | if (processStream == null) { |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | } |
| | | stream.setProductId(processStream.getProductId()); |
| | | stream.setComponentId(processStream.getComponentId()); |
| | | stream.setPartsId(processStream.getPartsId()); |
| | | stream.setProcessId(processStream.getProcessId()); |
| | | if (deviceTypeService.getById(stream.getAttributionId()) != null) { |
| | | stream.setDeviceTypeId(deviceTypeService.getById(stream.getAttributionId()).getId()); |
| | | } |
| | | return permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), user.getId(), "5"); |
| | | } |
| | | |
| | | private PermissionStreamNew handleWorkStep(AssignFileStream stream, String attributionId, LoginUser user) { |
| | | WorkStep workStep = workStepService.getById(attributionId); |
| | | if (workStep == null) { |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | } |
| | | stream.setProductId(workStep.getProductId()); |
| | | stream.setComponentId(workStep.getComponentId()); |
| | | stream.setPartsId(workStep.getPartsId()); |
| | | stream.setProcessId(workStep.getProcessId()); |
| | | stream.setStepId(workStep.getId()); |
| | | if (deviceTypeService.getById(stream.getAttributionId()) != null) { |
| | | stream.setDeviceTypeId(deviceTypeService.getById(stream.getAttributionId()).getId()); |
| | | } |
| | | return permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(workStep.getId(), user.getId(), "6"); |
| | | } |
| | | |
| | | //获取部门信息 |
| | | //todo 修改 |
| | | private List<String> getDepartIds(List<PermissionStream> permissionStreams, String userId) { |
| | | Map<String, MdcProduction> map = iMdcProductionService.getUserAssignedDepart(userId); |
| | | List<String> departIds = permissionStreams.stream() |
| | | .filter(item -> map.containsKey(item.getDepartId())) |
| | | .map(PermissionStream::getDepartId) |
| | | .collect(Collectors.toList()); |
| | | if (departIds.isEmpty()) { |
| | | ExceptionCast.cast(ActivitiCode.ACT_USER_NOT_PERM); |
| | | } |
| | | return departIds; |
| | | } |
| | | |
| | | |
| | | //封装数据 |
| | | private void saveBusinessObject(AssignFileStream stream, String userId) { |
| | |
| | | } |
| | | |
| | | //插入文件传输任务表 |
| | | private void handleFileTransfer(MdcEquipment mdcEquipment, DocFile docFile) { |
| | | @Override |
| | | public void handleFileTransfer(MdcEquipment mdcEquipment, DocFile docFile) { |
| | | List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); |
| | | if (strings != null && !strings.isEmpty()) { |
| | | String path = StringUtils.join(strings.toArray(), "/"); |
| | |
| | | } |
| | | |
| | | //封装处理文件 |
| | | private void handleFileProcessing(DocFile docFile, MdcEquipment mdcEquipment, String whether, String localFilePath) { |
| | | if (whether.equals("true") && !docFile.getFileSuffix().equals("zip") && !docFile.getFileSuffix().equals("rar")) { |
| | | String size = FileUtilS.fileSizeNC(docFile.getFilePath(), docFile.getFileEncodeName()); |
| | | private void handleFileProcessing(DocFile docFile, MdcEquipment mdcEquipment, String secretFolder) { |
| | | if (!docFile.getFileSuffix().equals("zip") && !docFile.getFileSuffix().equals("rar")) { |
| | | List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); |
| | | if (strings != null && !strings.isEmpty()) { |
| | | DncPassLog passInfoTxt = new DncPassLog(); |
| | | |
| | | String path = StringUtils.join(strings.toArray(), "/"); |
| | | Date dateFirst = DateUtil.getNow(); |
| | | NcTxtFilePathInfo ncTxt = new NcTxtFilePathInfo(); |
| | | ncTxt.setEquipmentId(mdcEquipment.getEquipmentId()); |
| | | ncTxt.setFileNcName("02A" + DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY)); |
| | | ncTxt.setFileTxtName("02A" + DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY)); |
| | | ncTxt.setFilePath(path + "/" + mdcEquipment.getEquipmentId() + "/"); |
| | | ncTxt.setOrigFileName(docFile.getFileName()); |
| | | ncTxt.setOrigFileSuffix(docFile.getFileSuffix()); |
| | | ncTxt.setFileAddOrDelete(1); |
| | | String loFilePath = localFilePath + ncTxt.getFileTxtName() + ".nc"; |
| | | try { |
| | | String allList = ncTxt.getFileTxtName() + "\n" |
| | | + ncTxt.getFileNcName() + "\n" |
| | | + ncTxt.getOrigFileName() + "\n" |
| | | + ncTxt.getOrigFileSuffix() + "\n" |
| | | + ncTxt.getFilePath() + "\n" |
| | | + ncTxt.getEquipmentId() + "\n" |
| | | + ncTxt.getFileAddOrDelete().toString() + "\n" |
| | | + size + "\n"; |
| | | FileUtilS.fileWriterSql(loFilePath, allList); |
| | | boolean copyFileNc = FileUtilS.copyFileUpName(path + "/" + mdcEquipment.getEquipmentId() + "/send/" + |
| | | docFile.getFileName(), |
| | | localFilePath + ncTxt.getFileNcName(), |
| | | docFile.getFileSuffix(), "NC"); |
| | | if (!copyFileNc) { |
| | | FileUtilS.deleteNcFile(loFilePath); |
| | | } |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("文件处理失败", e); |
| | | passInfoTxt.setDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)); |
| | | /*查询最后一条记录*/ |
| | | //休眠 500毫秒 |
| | | DncPassLog dncPassLog = dncPassLogService.findDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)); |
| | | int fileNc =0; |
| | | if (dncPassLog !=null) { |
| | | fileNc = dncPassLog.getSequenceNumber() + 1; |
| | | } else { |
| | | fileNc = 1; |
| | | } |
| | | //处理文件名称 文件路径 |
| | | String sequenceNc = String.format("%06d",fileNc); |
| | | DncPassLog passInfoNc = new DncPassLog(); |
| | | passInfoNc.setSequenceNumber(fileNc); |
| | | passInfoNc.setSequenceOrder(sequenceNc); |
| | | passInfoNc.setDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)); |
| | | passInfoNc.setPassType("02"); |
| | | passInfoNc.setPassName(docFile.getFileName()); |
| | | try { |
| | | Thread.sleep(1000); |
| | | Date date = new Date(); |
| | | passInfoNc.setCreateTime(date); |
| | | System.out.println(DateUtil.format(date,DateUtil.STR_DATE_TIME)); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | dncPassLogService.save(passInfoNc); |
| | | FileUtilS.copyFileUpName(path + "/" + mdcEquipment.getEquipmentId() + "/send/" + |
| | | docFile.getFileName(), |
| | | secretFolder +"/"+"10A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)+sequenceNc+"_"+mdcEquipment.getEquipmentId(), |
| | | docFile.getFileSuffix(), "NC"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理对应产品结构树、nc文件、刀具列表、程序加工确认表封装 |
| | | * @param docInfo |
| | | */ |
| | | private void handleProductTree(DocInfo docInfo,DocRelative docRelative,String equipmentId) { |
| | | /*查询最后一条记录*/ |
| | | //休眠 500毫秒 |
| | | DncPassLog passInfoTxt = new DncPassLog(); |
| | | Date dateFirst = DateUtil.getNow(); |
| | | passInfoTxt.setDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)); |
| | | DncPassLog dncPassLog = dncPassLogService.findDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)); |
| | | int fileTxt = 0, fileNc =0; |
| | | if (dncPassLog !=null) { |
| | | fileTxt = dncPassLog.getSequenceNumber() + 1; |
| | | } else { |
| | | fileTxt = 1; |
| | | } |
| | | String sequence = String.format("%06d",fileTxt); |
| | | passInfoTxt.setSequenceNumber(fileTxt); |
| | | passInfoTxt.setCreateTime(dateFirst); |
| | | passInfoTxt.setSequenceOrder(sequence); |
| | | System.out.println(DateUtil.format(dateFirst,DateUtil.STR_DATE_TIME)); |
| | | passInfoTxt.setPassType(DncPassLogPassType.PRODUCTSTRUCTURE.getCode()); |
| | | dncPassLogService.save(passInfoTxt); |
| | | String fileName="10A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY); |
| | | if (Objects.equals(docInfo.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode())){ |
| | | //工序对应设备类 |
| | | String filePath = ferryService.exportData(TransferPackage.DataType.PROCESS, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry"); |
| | | System.out.println("工序数据已导出: " + filePath); |
| | | }else { |
| | | //工步对应设备类 |
| | | String filePath = ferryService.exportData(TransferPackage.DataType.WORKSTEP, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry"); |
| | | System.out.println("工步数据已导出: " + filePath); |
| | | } |
| | | } |
| | | @Override |
| | | public void afterFlowHandle(FlowMyBusiness business) { |
| | | business.getTaskNameId();//接下来审批的节点 |