lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Cutter.java
@@ -38,6 +38,11 @@ @TableField(value = "doc_id") private String docId; //对åºåå ·åºid @Excel(name = "对åºåå ·åºid", width = 15) @TableField(value = "tools_id") private String toolsId; //åå ·åç§° @Excel(name = "åå ·åç§°", width = 15) @TableField(value = "cutter_name") @@ -48,8 +53,8 @@ @TableField(value = "cutter_code") private String cutterCode; //åå ·ç±»å @Excel(name = "åå ·ç±»å", width = 15,dicCode = "cutter_type") //åå ·ç®ç§° @Excel(name = "åå ·ç®ç§°", width = 15,dicCode = "cutter_type") @TableField(value = "cutter_type") @Dict(dicCode = "cutter_type") private String cutterType; lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DncPassLog.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,36 @@ package org.jeecg.modules.dnc.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.NoArgsConstructor; import java.util.Date; /** * @author clown * * @date 2023/11/29 */ @Data @NoArgsConstructor @TableName(value = "dnc_pass_log") public class DncPassLog { @TableId private String id; //åç§° private String passName; //åºå· private String sequenceOrder; //æ¶é´ private String dayTime; //ç±»å private String passType; // æä»¶åç§° private String passLogFileName; //顺åºå· private Integer sequenceNumber; private Date createTime; } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DncPassLogMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,18 @@ package org.jeecg.modules.dnc.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.dnc.entity.DncPassLog; /** * @author clown * * @date 2023/11/29 */ public interface DncPassLogMapper extends BaseMapper<DncPassLog> { /** * æ¥è¯¢æä¸å¤©æå䏿¡è®°å½ * @param dayTime * @return */ DncPassLog findDateTimeDay(@Param("dayTime")String dayTime); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/MdcPassLogMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,9 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="org.jeecg.modules.dnc.mapper.DncPassLogMapper"> <select id="findDateTimeDay" resultType="org.jeecg.modules.dnc.entity.DncPassLog" parameterType="String"> select top 1 * from dnc_pass_log u where day_time = #{dayTime} order by create_time desc </select> </mapper> lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/DocumentCode.java
@@ -31,7 +31,8 @@ DOC_UPLOAD_ERROR(false, 25323, "ææ¡£å¯¼å ¥å¤±è´¥ï¼"), DOC_DEL_ERROR(false, 25324, "è¯¥ææ¡£æ æ³å é¤ï¼"), DOC_IS_EXIST(false, 25325, "è¯¥ææ¡£å·²åå¨ï¼"), DOC_DEVICE_EXIST(false, 25326, "è¯¥ææ¡£æè®¾å¤å ³èä¿¡æ¯ï¼"); DOC_DEVICE_EXIST(false, 25326, "è¯¥ææ¡£æè®¾å¤å ³èä¿¡æ¯ï¼"), DOC_BATCH_ERROR(false, 25327, "å¯¼å ¥ææ¡£æ°å¢æ¹æ¬¡å¤±è´¥ï¼è¯·éè¯ï¼"); //æä½ä»£ç @ApiModelProperty(value = "æä½æ¯å¦æå", example = "true", required = true) @@ -43,7 +44,7 @@ //æç¤ºä¿¡æ¯ @ApiModelProperty(value = "æä½æç¤º", example = "æä½è¿äºé¢ç¹ï¼", required = true) String message; private DocumentCode(boolean success, int code, String message){ DocumentCode(boolean success, int code, String message){ this.success = success; this.code = code; this.message = message; lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDncPassLogService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,19 @@ package org.jeecg.modules.dnc.service; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.dnc.entity.DncPassLog; /** * @author clown * * @date 2023/11/29 */ public interface IDncPassLogService extends IService<DncPassLog> { /** * æ¥è¯¢æä¸å¤©çæ°æ® * @param dateDay * @return */ DncPassLog findDayTime(String dateDay); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IGuideCardBatchService.java
@@ -17,4 +17,11 @@ * @return */ String getSerialNumber(String code); /** * å¯¼å ¥NCæä»¶é»è®¤äº§çncæä»¶å¯¹åºæ°æ§ç¨åºå 工确认表 * @param docId * @return */ boolean importGuideCardBatch(String docId,String attributionId,Integer attributionType); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DncPassLogServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,23 @@ package org.jeecg.modules.dnc.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.modules.dnc.entity.DncPassLog; import org.jeecg.modules.dnc.mapper.DncPassLogMapper; import org.jeecg.modules.dnc.service.IDncPassLogService; import org.jeecg.modules.dnc.utils.ValidateUtil; import org.springframework.stereotype.Service; /** * @author clown * * @date 2023/11/29 */ @Service public class DncPassLogServiceImpl extends ServiceImpl<DncPassLogMapper, DncPassLog> implements IDncPassLogService { @Override public DncPassLog findDayTime(String dateDay) { if (!ValidateUtil.validateString(dateDay)) { return null; } return super.baseMapper.findDateTimeDay(dateDay); } } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java
@@ -67,6 +67,9 @@ @Autowired @Lazy private IComponentInfoService componentInfoService; @Autowired @Lazy private IGuideCardBatchService guideCardBatchService; /*å¤ä»½å¤ç*/ @Override @@ -176,6 +179,12 @@ } } } 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; } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/GuideCardBatchServiceImpl.java
@@ -5,12 +5,14 @@ import org.apache.shiro.SecurityUtils; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.DateUtils; import org.jeecg.modules.dnc.entity.GuideCardBatch; import org.jeecg.modules.dnc.constant.DocAttributionTypeEnum; import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.dnc.mapper.GuideCardBatchMapper; import org.jeecg.modules.dnc.service.IGuideCardBatchService; import org.jeecg.modules.dnc.service.*; import org.jeecg.modules.system.service.ISysDictService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Date; import java.util.List; @@ -27,6 +29,24 @@ @Autowired private ISysDictService sysDictService; @Autowired private IDocInfoService docInfoService; @Autowired private IDocRelativeService docRelativeService; @Autowired private IPartsInfoService partsInfoService; @Autowired private IProcessStreamService processStreamService; @Autowired private IWorkStepService workStepService; @Autowired private IDeviceTypeService deviceTypeService; /** * çææµæ°´å· * @param code @@ -42,9 +62,9 @@ // æ¥è¯¢å½å¹´ææè®°å½ QueryWrapper<GuideCardBatch> wrapper = new QueryWrapper<>(); wrapper.likeRight("create_time", DateUtils.formatDate(new Date(), "yyyy")); wrapper.apply("YEAR(create_time) = YEAR(GETDATE())"); wrapper.isNotNull("serial_number"); wrapper.orderByDesc("SUBSTR(serial_number, -4)"); wrapper.orderByDesc("SUBSTRING(serial_number, LEN(serial_number)-3, 4)"); List<GuideCardBatch> list = this.list(wrapper); @@ -62,10 +82,65 @@ serialSuffix = "0001"; // å½å¹´æ è®°å½ååå§å } // è·ååä½ç¼ç String unitCode = sysDictService.queryDictTextByKey("unit_code", code); // æ¼æ¥å®æ´ç¼å· return yearSuffix + unitCode + user.getUsername() + serialSuffix; return yearSuffix + code + user.getUsername() + serialSuffix; } /** * å¯¼å ¥NCæä»¶é»è®¤äº§çncæä»¶å¯¹åºæ°æ§ç¨åºå 工确认表 * @param docId * @return */ @Override @Transactional(rollbackFor = Exception.class) public boolean importGuideCardBatch(String docId,String attributionId,Integer attributionType){ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); DocInfo docInfo=docInfoService.getById(docId); if (docInfo==null){ return false; } PartsInfo partsInfo=new PartsInfo(); ProcessStream processStream; WorkStep workStep; DeviceType deviceType; GuideCardBatch guideCardBatch=new GuideCardBatch(); if (DocAttributionTypeEnum.PROCESS.getCode().equals(attributionType)){ //å·¥åºè®¾å¤ç±» deviceType=deviceTypeService.getById(attributionId); if (deviceType==null){ return false; } processStream=processStreamService.getById(deviceType.getAttributionId()); if (processStream==null){ return false; } guideCardBatch.setProcessWorkCode(processStream.getProcessCode()); partsInfo=partsInfoService.getById(processStream.getPartsId()); }else if (DocAttributionTypeEnum.WORKSITE.getCode().equals(attributionType)){ //å·¥æ¥è®¾å¤ç±» deviceType=deviceTypeService.getById(attributionId); if (deviceType==null){ return false; } workStep=workStepService.getById(deviceType.getAttributionId()); if (workStep==null){ return false; } guideCardBatch.setProcessWorkCode(workStep.getStepCode()); partsInfo=partsInfoService.getById(workStep.getPartsId()); } if (partsInfo==null){ return false; } guideCardBatch.setDocId(docId); guideCardBatch.setSerialNumber(getSerialNumber("C140")); guideCardBatch.setUnit(sysDictService.queryDictTextByKey("unit_code", "C140")); guideCardBatch.setDocName(docInfo.getDocName()); guideCardBatch.setPartsCode(partsInfo.getPartsCode()); guideCardBatch.setPartsName(partsInfo.getPartsName()); guideCardBatch.setMaterielDesp(partsInfo.getMaterielDesp()); guideCardBatch.setCompiler(user.getUsername()); guideCardBatch.setCreateTime(new Date()); return this.save(guideCardBatch); } } lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java
@@ -44,6 +44,7 @@ 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.message.enums.DeployEnum; import org.jeecg.modules.system.service.IMdcProductionService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -103,11 +104,14 @@ private IFlowMyBusinessService flowMyBusinessService; @Autowired private PermissionService permissionService; @Value("${securedoc.whether}") private String whether; @Value("${securedoc.localFilePath}") private String localFilePath; @Autowired private IDncPassLogService dncPassLogService; @Value("${deploy.deployType}") //å·¥æ§ç½/æ¶å¯ç½é¨ç½² 0为工æ§ç½ 1为æ¶å¯ç½ private String deployType; @Value("${deploy.secretFolder}") //æ¶å¯ç½ä¼ è¾ncæä»¶å¤¹ private String secretFolder; @Override @Transactional(rollbackFor = {Exception.class}) @@ -258,7 +262,10 @@ } handleFileTransfer(mdcEquipment, docFile); handleFileProcessing(docFile, mdcEquipment, whether, localFilePath); //注æ----åºåå·¥æ§ç½ä¸æ¶å¯ç½ï¼ï¼ï¼ æ¶å¯ç½è¿è¡NCæä»¶çæ·è´ï¼å·¥æ§ç½è´è´£è¿è¡è§£æNCæä»¶ if (deployType.equals(DeployEnum.SMW.getCode())) { handleFileProcessing(docFile, mdcEquipment, secretFolder); } synchronizedFlagService.updateFlag(2); return Result.OK("æä½æå"); } @@ -380,6 +387,10 @@ docFile.getFileName(),docFile.getFileSuffix()); } } } //注æ----åºåå·¥æ§ç½ä¸æ¶å¯ç½ï¼ï¼ï¼ æ¶å¯ç½è¿è¡NCæä»¶çæ·è´ï¼å·¥æ§ç½è´è´£è¿è¡è§£æNCæä»¶ if (deployType.equals(DeployEnum.SMW.getCode())) { handleFileProcessing(docFile, mdcEquipment, secretFolder); } return synchronizedFlagService.updateFlag(1); }else if(up.getStatus() == 3) { @@ -650,22 +661,61 @@ } //å°è£ å¤çæä»¶ private void handleFileProcessing(DocFile docFile, MdcEquipment mdcEquipment, String whether, String localFilePath) { if (whether.equals("true") && !docFile.getFileSuffix().equals("zip") && !docFile.getFileSuffix().equals("rar")) { private void handleFileProcessing(DocFile docFile, MdcEquipment mdcEquipment, String secretFolder) { if (!docFile.getFileSuffix().equals("zip") && !docFile.getFileSuffix().equals("rar")) { String size = FileUtilS.fileSizeNC(docFile.getFilePath(), docFile.getFileEncodeName()); 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(); passInfoTxt.setDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)); /*æ¥è¯¢æå䏿¡è®°å½*/ //ä¼ç 500æ¯«ç§ 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; } fileNc = fileTxt + 1; //å¤çæä»¶åç§° æä»¶è·¯å¾ String sequence = String.format("%06d",fileTxt); String sequenceNc = String.format("%06d",fileNc); passInfoTxt.setSequenceNumber(fileTxt); passInfoTxt.setSequenceOrder(sequence); passInfoTxt.setCreateTime(dateFirst); System.out.println(DateUtil.format(dateFirst,DateUtil.STR_DATE_TIME)); passInfoTxt.setPassType("02"); dncPassLogService.save(passInfoTxt); 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); 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.setFileNcName("10A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)+sequenceNc); ncTxt.setFileTxtName("10A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)+sequence); ncTxt.setFilePath(path + "/" + mdcEquipment.getEquipmentId() + "/"); ncTxt.setOrigFileName(docFile.getFileName()); ncTxt.setOrigFileSuffix(docFile.getFileSuffix()); ncTxt.setFileAddOrDelete(1); String loFilePath = localFilePath + ncTxt.getFileTxtName() + ".nc"; String loFilePath = secretFolder +"/"+ ncTxt.getFileTxtName() + ".nc"; try { String allList = ncTxt.getFileTxtName() + "\n" + ncTxt.getFileNcName() + "\n" @@ -678,7 +728,7 @@ FileUtilS.fileWriterSql(loFilePath, allList); boolean copyFileNc = FileUtilS.copyFileUpName(path + "/" + mdcEquipment.getEquipmentId() + "/send/" + docFile.getFileName(), localFilePath + ncTxt.getFileNcName(), secretFolder +"/"+ncTxt.getFileNcName(), docFile.getFileSuffix(), "NC"); if (!copyFileNc) { FileUtilS.deleteNcFile(loFilePath); lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/message/enums/DeployEnum.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,36 @@ package org.jeecg.modules.message.enums; /** * åºåå·¥æ§ç½/æ¶å¯ç½é¨ç½²ç¸å ³é ç½® */ public enum DeployEnum { SMW("0", "æ¶å¯ç½"), GW("1", "å·¥æ§ç½"); private String code; private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } DeployEnum() { } DeployEnum(String code, String name) { this.code = code; this.name = name; } } lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml
@@ -135,7 +135,7 @@ database: 0 host: 127.0.0.1 port: 6379 password: '' password: '123456' flowable: enable: true #å ³é宿¶ä»»å¡JOB @@ -298,35 +298,6 @@ namespace: http://service.server.webservice.example.com statusMethod: equipmentStatus rateMethod: equipmentRate securedoc: #ååºç½ä¸ç½é¸é讯客æ·ç«¯ whether: true #æ¯å¦å¯ç¨ true / false serverIp: 10.118.10.63 #æ°æ®æå¡ç«¯IP serverPort: 8399 #æ°æ®æå¡ç«¯æ¥å£ # serverIp: 127.0.0.1 #æ°æ®æå¡ç«¯IP # serverPort: 8399 #æ°æ®æå¡ç«¯æ¥å£ username: admin #å®ä¹è´¦å· pwd: 123 #å®ä¹å¯ç addressToken: /outer/appAuth #æå¡æ®µè·åtokenå°å addressUploadFile: /outer/fileUpload #æå¡æ®µä¸ä¼ å°å localFilePath: E:\\test\\a #æ¥æ¶å°å servicePath: E:\\test\\b #åéå°å copyFilePath: E:\\test\\bak_a #æä»¶å¤ä»½å°å # localFilePath: /jar/test/a/ #æ¥æ¶å°å # servicePath: /jar/test/b/ #åéå°å # copyFilePath: /jar/test/bak_a/ #æä»¶å¤ä»½å°å logIp: 127.0.0.1 #æ¥å¿ç³»ç»å°å logPort: 8888 #æ¥å¿ç³»ç»ç«¯å£ serviceIntranet: #ååºç½ä¸ç½é¸é讯æå¡æ®µ # filePath: E:\\test\\b #éæå®¢æ·ç«¯ä¿åå°å # newFilePath: E:/test/bak_sql/ #æä»¶å¤ä»½å°å filePath: /jar/test/b/ #éæå®¢æ·ç«¯ä¿åå°å newFilePath: /jar/test/bak_sql/ #æä»¶å¤ä»½å°å appIdCheck: admin #token ç¨æ·å passwordCheck: 123 #token å¯ç logIp: 127.0.0.1 logPort: 8888 clientIp: 127.0.0.1 #客æ·ç«¯IP fileNumPath: D:/demo/fileNum.txt #顺åºå·è®°å½å°å #æä»¶ä¸ä¼ ç®å½ï¼æ³¨æLinuxåWindowsä¸çç®å½ç»æä¸åï¼ #file.uploadFolder=/root/uploadFiles/ #fileHomePath: ${UPLOAD_FOLDER:/jar/lxzn_storage} @@ -336,3 +307,11 @@ ncSend: addOrDelete: false #//æ¯å¦å é¤seed ä¸çä¹åæä»¶ #staticAccessPath: /api/ffile/** # å½å项ç®çéæèµæºè®¿é®é ç½®å¨nginxä¸ #å·¥æ§ç½/æ¶å¯ç½é¨ç½²ç¸å ³é ç½®------------éè¿å çææ¸¡ deploy: #å·¥æ§ç½/æ¶å¯ç½é¨ç½² 0为æ¶å¯ç½ 1为工æ§ç½ deployType: 0 #æ¶å¯ç½ä¼ è¾ncæä»¶å¤¹ secretFolder: D:\\hy_test\\a #å·¥æ§ç½çæ§ncæä»¶å¤¹ workFolder: D:\\hy_test\\b