| | |
| | | String YN_Y = "Y"; |
| | | String YN_N = "N"; |
| | | |
| | | /** |
| | | * 1æ¯0å¦ |
| | | */ |
| | | String YN_O = "0"; |
| | | String YN_1 = "1"; |
| | | |
| | | /** |
| | | * 1éè¿ 2驳å |
| | | */ |
| | | String APPROVED = "1"; |
| | | String REJECTED = "2"; |
| | | |
| | | /**===============================================================================================*/ |
| | | /** |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.dnc.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @author Lyh |
| | | * @Description: DNCé¦é¡µæ¥å£ |
| | | * @date 2024/3/13 14:27 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "DNCé¦é¡µæ¥å£") |
| | | @RestController |
| | | @RequestMapping("/dnc/home") |
| | | |
| | | //todo dncé¦é¡µç¸å
³æ¥å£å¾
å® |
| | | public class DncHomeController { |
| | | |
| | | /** |
| | | * ä¸ç»´å·¥èºå·¥èºè§ç¨ä¿¡æ¯å表 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "ä¸ç»´å·¥èºå·¥èºè§ç¨ä¿¡æ¯å表", notes = "ä¸ç»´å·¥èºå·¥èºè§ç¨ä¿¡æ¯å表") |
| | | @GetMapping(value = "/syncProcessSpecificationInfo") |
| | | public Result<?> syncProcessSpecificationInfo() { |
| | | return Result.ok(); |
| | | } |
| | | |
| | | /** |
| | | * ä¸ç»´å·¥èºå·¥èºè§ç¨ä¿¡æ¯é¢åæé 产åç»ææ |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "ä¸ç»´å·¥èºå·¥èºè§ç¨ä¿¡æ¯é¢åæé 产åç»ææ ", notes = "ä¸ç»´å·¥èºå·¥èºè§ç¨ä¿¡æ¯é¢åæé 产åç»ææ ") |
| | | @GetMapping(value = "/receiveTree") |
| | | public Result<?> syncProcessSpecificationInfoTree(@RequestParam(name = "id") String id) throws JsonProcessingException { |
| | | return Result.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonIgnoreProperties(ignoreUnknown = true) |
| | | public class TransferPackage { |
| | | public enum DataType { PROCESS, WORKSTEP } |
| | | public enum DataType {PRODUCT,COMPONENT,PARTS,OPERATION,PROCESS,WORKSTEP} |
| | | |
| | | private final DataType dataType; |
| | | private final DocRelative docRelative; |
| | |
| | | |
| | | @Override |
| | | public void onStart(FileAlterationObserver observer) { |
| | | // log.info("å¼å§çå¬ç®å½: {}", observer.getDirectory().getAbsolutePath()); |
| | | log.info("å¼å§çå¬ç®å½: {}", observer.getDirectory().getAbsolutePath()); |
| | | } |
| | | |
| | | @Override |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.dnc.service.impl; |
| | | |
| | | import org.jeecg.modules.dnc.dto.TransferPackage; |
| | | import org.jeecg.modules.dnc.entity.ComponentInfo; |
| | | import org.jeecg.modules.dnc.entity.DocRelative; |
| | | import org.jeecg.modules.dnc.mapper.ComponentInfoMapper; |
| | | import org.jeecg.modules.dnc.mapper.DeviceTypeMapper; |
| | | import org.jeecg.modules.dnc.mapper.DocRelativeMapper; |
| | | import org.jeecg.modules.dnc.service.DataPackageStrategy; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class ComponentPackageStrategy implements DataPackageStrategy { |
| | | @Autowired |
| | | private ComponentInfoMapper componentInfoMapper; |
| | | @Autowired |
| | | private DeviceTypeMapper deviceTypeMapper; |
| | | @Autowired |
| | | private FullHierarchyTraceService traceService; |
| | | @Autowired |
| | | private DocRelativeMapper docRelativeMapper; |
| | | |
| | | @Override |
| | | public TransferPackage packageData(String relativeId) { |
| | | DocRelative docRelative=docRelativeMapper.selectById(relativeId); |
| | | ComponentInfo componentInfo=componentInfoMapper.selectById(docRelative.getAttributionId()); |
| | | if (componentInfo == null) { |
| | | throw new IllegalArgumentException("对åºçé¨ä»¶ä¸åå¨: " + docRelative.getAttributionId()); |
| | | } |
| | | return TransferPackage.builder() |
| | | .dataType(TransferPackage.DataType.COMPONENT) |
| | | .docRelative(docRelative) |
| | | .traceChain(traceService.traceFromComponent(docRelative)) |
| | | .build(); |
| | | } |
| | | } |
| | |
| | | } |
| | | break; |
| | | case "2": |
| | | |
| | | if (StrUtil.isNotEmpty(item.getUserId())){ |
| | | ComponentPermission componentPermission = new ComponentPermission(); |
| | | componentPermission.setComponentId(item.getBusinessId()); |
| | |
| | | public DataPackageService(List<DataPackageStrategy> strategyList) { |
| | | strategies = new EnumMap<>(TransferPackage.DataType.class); |
| | | strategyList.forEach(strategy -> { |
| | | if (strategy instanceof ProcessPackageStrategy) { |
| | | if (strategy instanceof ProductPackageStrategy) { |
| | | strategies.put(TransferPackage.DataType.PRODUCT, strategy); |
| | | } else if (strategy instanceof ComponentPackageStrategy) { |
| | | strategies.put(TransferPackage.DataType.COMPONENT, strategy); |
| | | } else if (strategy instanceof PartsPackageStrategy) { |
| | | strategies.put(TransferPackage.DataType.PARTS, strategy); |
| | | } else if (strategy instanceof ProcessSpecVersionPackageStrategy) { |
| | | strategies.put(TransferPackage.DataType.OPERATION, strategy); |
| | | } else if (strategy instanceof ProcessPackageStrategy) { |
| | | strategies.put(TransferPackage.DataType.PROCESS, strategy); |
| | | } else if (strategy instanceof WorkStepPackageStrategy) { |
| | | strategies.put(TransferPackage.DataType.WORKSTEP, strategy); |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import liquibase.pro.packaged.S; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jeecg.modules.dnc.constant.DocAttributionTypeEnum; |
| | | import org.jeecg.modules.dnc.dto.ComponentHierarchy; |
| | | import org.jeecg.modules.dnc.dto.TransferPackage; |
| | | import org.jeecg.modules.dnc.entity.*; |
| | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.nio.charset.StandardCharsets; |
| | |
| | | import java.nio.file.StandardCopyOption; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service |
| | | public class FileFerryService { |
| | |
| | | @Value("${jeecg.path.upload}") |
| | | private String upLoadPath; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private MdcEquipmentMapper mdcEquipmentMapper; |
| | | |
| | | @Autowired |
| | |
| | | throw new RuntimeException("æä»¶åå
¥å¤±è´¥", e); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public TransferPackage importData(String filePath) { |
| | | try { |
| | |
| | | long number = Long.parseLong(numericPart); |
| | | number--; // è·ååä¸ä¸ªåºåå· |
| | | |
| | | // ä¿æç¸å使°æ ¼å¼ |
| | | String newNumeric = String.format("%0" + numericPart.length() + "d", number); |
| | | String ncFileName = prefix + newNumeric + "_" + equipmentId+".NC"; |
| | | String ncFilePath = path.getParent().resolve(ncFileName).toString(); |
| | | |
| | | // 6. è·åæä»¶å¤å¶ç®æ è·¯å¾ |
| | | DocRelative docRelative=pkg.getDocRelative(); |
| | | DocFile docFile = pkg.getTraceChain().getDocFile(); |
| | | DocInfo docInfo = pkg.getTraceChain().getDocInfo(); |
| | | if (docFile == null) { |
| | | throw new IllegalStateException("ä¼ è¾å
ä¸ç¼ºå°ææ¡£æä»¶ä¿¡æ¯"); |
| | | } |
| | | |
| | | // ä¿æç¸å使°æ ¼å¼ |
| | | String newNumeric = String.format("%0" + numericPart.length() + "d", number); |
| | | String ncFileName = ""; |
| | | if (Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode()) || |
| | | Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.WORKSITE.getCode())) { |
| | | //NCæä»¶çæ·è´ |
| | | ncFileName = prefix + newNumeric + "_" + equipmentId+".NC"; |
| | | }else { |
| | | //å
¶ä»ææ¡£çæ·è´ |
| | | ncFileName = prefix + newNumeric + "_" + equipmentId+"."+docFile.getFileSuffix(); |
| | | docInfo.setDocDispatchStatus(3); |
| | | pkg.getTraceChain().setDocInfo(docInfo); |
| | | } |
| | | String ncFilePath = path.getParent().resolve(ncFileName).toString(); |
| | | // æå»ºç®æ è·¯å¾ |
| | | String targetDirectory = fileHomePath + docFile.getFilePath(); |
| | | String targetPath = Paths.get(targetDirectory, docFile.getFileEncodeName()).toString(); |
| | |
| | | DocClassification classification = classificationService.getByCode("send"); |
| | | 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(mdcEquipment.getId()); |
| | | docRelativeService.save(docRelative); |
| | | DocRelative newDocRelative = new DocRelative(); |
| | | newDocRelative.setDocId(docInfo.getDocId()); |
| | | newDocRelative.setClassificationId(classification.getClassificationId()); |
| | | newDocRelative.setAttributionType(7); |
| | | newDocRelative.setAttributionId(mdcEquipment.getId()); |
| | | docRelativeService.save(newDocRelative); |
| | | } |
| | | String sendPath = StringUtils.join(strings.toArray(), "/"); |
| | | boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(), sendPath + "/" + mdcEquipment.getEquipmentId(), |
| | |
| | | } else { |
| | | throw new RuntimeException("æä»¶ä¼ è¾è·¯å¾è·å失败"); |
| | | } |
| | | |
| | | // 计ç®åä¸ä¸ªæä»¶å |
| | | long nextNumber = Long.parseLong(numericPart); |
| | | nextNumber++; |
| | | |
| | | //è·ååºååçç¨åºç¡®è®¤è¡¨æ°æ® |
| | | GuideCardBatch guideCardBatch=pkg.getTraceChain().getGuideCardBatch(); |
| | | if (guideCardBatch!=null){ |
| | | // 计ç®åä¸ä¸ªæä»¶å |
| | | long nextNumber = Long.parseLong(numericPart); |
| | | nextNumber++; |
| | | //è·åæä»¶è·¯å¾ |
| | | String pictureUrl=guideCardBatch.getPicture(); |
| | | |
| | | //è·åæä»¶è·¯å¾ |
| | | String pictureUrl=guideCardBatch.getPicture(); |
| | | // ä¿æç¸å使°æ ¼å¼ |
| | | String nextNumeric = String.format("%0" + numericPart.length() + "d", nextNumber); |
| | | String nextFileName = prefix + nextNumeric + "_" + equipmentId+"."+pictureUrl.split("\\.")[1]; |
| | | String nextFilePath = path.getParent().resolve(nextFileName).toString(); |
| | | |
| | | // ä¿æç¸å使°æ ¼å¼ |
| | | String nextNumeric = String.format("%0" + numericPart.length() + "d", nextNumber); |
| | | String nextFileName = prefix + nextNumeric + "_" + equipmentId+"."+pictureUrl.split("\\.")[1]; |
| | | String nextFilePath = path.getParent().resolve(nextFileName).toString(); |
| | | //æ¼æ¥ç°æè·¯å¾ |
| | | String picturePtah=upLoadPath+"/"+pictureUrl; |
| | | |
| | | //æ¼æ¥ç°æè·¯å¾ |
| | | String picturePtah=upLoadPath+"/"+pictureUrl; |
| | | |
| | | // 9. å¤å¶æä»¶å¹¶éå½å |
| | | logger.info("å¤å¶æä»¶: {} â {}", nextFilePath,picturePtah); |
| | | Path PicSource= Paths.get(nextFilePath); |
| | | Files.copy(PicSource, Paths.get(picturePtah), StandardCopyOption.REPLACE_EXISTING); |
| | | // 9. å¤å¶æä»¶å¹¶éå½å |
| | | logger.info("å¤å¶æä»¶: {} â {}", nextFilePath,picturePtah); |
| | | Path PicSource= Paths.get(nextFilePath); |
| | | Files.copy(PicSource, Paths.get(picturePtah), StandardCopyOption.REPLACE_EXISTING); |
| | | Files.delete(PicSource); |
| | | } |
| | | |
| | | // å 餿件 |
| | | logger.info("å é¤ä¸´æ¶æä»¶: {}", ncFilePath); |
| | | Files.delete(source); |
| | | Files.delete(path); |
| | | Files.delete(PicSource); |
| | | |
| | | return JsonUtils.fromJson(json, TransferPackage.class); |
| | | return pkg; |
| | | |
| | | } catch (NumberFormatException e) { |
| | | throw new RuntimeException("æä»¶åä¸çæ°åæ ¼å¼æ æ: " + e.getMessage(), e); |
| | |
| | | pkg.getTraceChain().getComponentHierarchy().getComponents().size() < 4) { |
| | | return; |
| | | } |
| | | |
| | | ComponentHierarchy hierarchy = pkg.getTraceChain().getComponentHierarchy(); |
| | | List<ComponentInfo> compressed = new ArrayList<>(); |
| | | |
| | |
| | | import org.jeecg.modules.dnc.entity.*; |
| | | import org.jeecg.modules.dnc.mapper.*; |
| | | import org.jeecg.modules.dnc.service.IPermissionStreamNewService; |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private CutterMapper cutterMapper; |
| | | @Autowired |
| | | private GuideCardBatchMapper guideCardBatchMapper; |
| | | @Autowired |
| | | private IPermissionStreamNewService permissionStreamNewService; |
| | | @Autowired |
| | | private ISysUserService sysUserService; |
| | | @Autowired |
| | | private IMdcProductionService mdcProductionService; |
| | | |
| | | /** |
| | | * 产åå°è£
|
| | | * @param docRelative |
| | | * @return |
| | | */ |
| | | public ProcessTraceChain traceFromProduct(DocRelative docRelative) { |
| | | ProcessTraceChain chain = initChainWithDocInfo(docRelative); |
| | | traceProductChain(chain, docRelative.getAttributionId()); |
| | | List<ProductMix> productMixList=buildFullTreePath(chain); |
| | | chain.setTreePath(productMixList); |
| | | chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList)); |
| | | return chain; |
| | | } |
| | | |
| | | /** |
| | | * é¨ä»¶å°è£
|
| | | * @param docRelative |
| | | * @return |
| | | */ |
| | | public ProcessTraceChain traceFromComponent(DocRelative docRelative) { |
| | | ProcessTraceChain chain = initChainWithDocInfo(docRelative); |
| | | traceComponentChain(chain, docRelative.getAttributionId()); |
| | | List<ProductMix> productMixList=buildFullTreePath(chain); |
| | | chain.setTreePath(productMixList); |
| | | chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList)); |
| | | return chain; |
| | | } |
| | | |
| | | /** |
| | | * é¶ä»¶å°è£
|
| | | * @param docRelative |
| | | * @return |
| | | */ |
| | | public ProcessTraceChain traceFromParts(DocRelative docRelative) { |
| | | ProcessTraceChain chain = initChainWithDocInfo(docRelative); |
| | | tracePartsChain(chain, docRelative.getAttributionId()); |
| | | List<ProductMix> productMixList=buildFullTreePath(chain); |
| | | chain.setTreePath(productMixList); |
| | | chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList)); |
| | | return chain; |
| | | } |
| | | |
| | | /** |
| | | * å·¥èºè§ç¨çæ¬å°è£
|
| | | * @param docRelative |
| | | * @return |
| | | */ |
| | | public ProcessTraceChain traceFromPsv(DocRelative docRelative) { |
| | | ProcessTraceChain chain = initChainWithDocInfo(docRelative); |
| | | traceProcessSpecVersionChain(chain, docRelative.getAttributionId()); |
| | | List<ProductMix> productMixList=buildFullTreePath(chain); |
| | | chain.setTreePath(productMixList); |
| | | chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList)); |
| | | return chain; |
| | | } |
| | | |
| | | /** |
| | | * å·¥åºå°è£
|
| | | * @param docRelative |
| | | * @return |
| | | */ |
| | | public ProcessTraceChain traceFromProcess(DocRelative docRelative) { |
| | | ProcessTraceChain chain = initChainWithDocInfo(docRelative); |
| | | DeviceType deviceType = deviceTypeMapper.selectById(docRelative.getAttributionId()); |
| | |
| | | completeChainWithProductInfo(chain); |
| | | List<ProductMix> productMixList=buildFullTreePath(chain); |
| | | chain.setTreePath(productMixList); |
| | | chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList)); |
| | | return chain; |
| | | } |
| | | |
| | | /** |
| | | * å·¥æ¥å°è£
|
| | | * @param docRelative |
| | | * @return |
| | | */ |
| | | public ProcessTraceChain traceFromWorkStep(DocRelative docRelative) { |
| | | ProcessTraceChain chain = initChainWithDocInfo(docRelative); |
| | | DeviceType deviceType = deviceTypeMapper.selectById(docRelative.getAttributionId()); |
| | |
| | | completeChainWithProductInfo(chain); |
| | | List<ProductMix> productMixList=buildFullTreePath(chain); |
| | | chain.setTreePath(productMixList); |
| | | chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList)); |
| | | return chain; |
| | | } |
| | | |
| | |
| | | .ifPresent(doc -> { |
| | | chain.setDocInfo(doc); |
| | | chain.setDocFile(docFileMapper.selectById(doc.getPublishFileId())); |
| | | chain.setCutterList(getCuttersByDocId(doc.getDocId())); |
| | | getLatestGuideCardBatch(doc.getDocId()).ifPresent(chain::setGuideCardBatch); |
| | | }); |
| | | if (Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode()) || |
| | | Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.WORKSITE.getCode())) { |
| | | chain.setCutterList(getCuttersByDocId(doc.getDocId())); |
| | | getLatestGuideCardBatch(doc.getDocId()).ifPresent(chain::setGuideCardBatch); |
| | | }}); |
| | | return chain; |
| | | } |
| | | |
| | |
| | | private boolean isWorkSiteType(DeviceType deviceType) { |
| | | return deviceType != null && |
| | | Objects.equals(deviceType.getAttributionType(), DocAttributionTypeEnum.WORKSITE.getCode()); |
| | | } |
| | | |
| | | private void traceProductChain(ProcessTraceChain chain, String productId) { |
| | | ProductInfo product = productMapper.selectById(productId); |
| | | chain.setProduct(product); |
| | | } |
| | | |
| | | private void traceComponentChain(ProcessTraceChain chain, String componentId) { |
| | | chain.setComponentHierarchy(traceComponentHierarchy(componentId)); |
| | | Optional.ofNullable(chain.getComponentHierarchy()) |
| | | .map(ComponentHierarchy::getRootProduct) |
| | | .ifPresent(chain::setProduct); |
| | | } |
| | | |
| | | private void tracePartsChain(ProcessTraceChain chain, String partsId) { |
| | | PartsInfo parts = partsMapper.selectById(partsId); |
| | | chain.setParts(parts); |
| | | if (parts != null) { |
| | | if (parts.getComponentId() != null) { |
| | | chain.setComponentHierarchy(traceComponentHierarchy(parts.getComponentId())); |
| | | Optional.ofNullable(chain.getComponentHierarchy()) |
| | | .map(ComponentHierarchy::getRootProduct) |
| | | .ifPresent(chain::setProduct); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void traceProcessSpecVersionChain(ProcessTraceChain chain, String psvId) { |
| | | ProcessSpecVersion psv = psvMapper.selectById(psvId); |
| | | chain.setProcessSpec(psv); |
| | | if (psv != null) { |
| | | if (psv.getPartsId() != null) { |
| | | PartsInfo parts = partsMapper.selectById(psv.getPartsId()); |
| | | chain.setParts(parts); |
| | | if (parts != null && parts.getComponentId() != null) { |
| | | chain.setComponentHierarchy(traceComponentHierarchy(parts.getComponentId())); |
| | | Optional.ofNullable(chain.getComponentHierarchy()) |
| | | .map(ComponentHierarchy::getRootProduct) |
| | | .ifPresent(chain::setProduct); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void traceProcessChain(ProcessTraceChain chain, String processId) { |
| | |
| | | return path; |
| | | } |
| | | |
| | | private List<PermissionStreamNew> buildFullTreePathPermission(List<ProductMix> productMixList) { |
| | | List<Long> ids=productMixList.stream().map(ProductMix::getId).collect(Collectors.toList()); |
| | | List<PermissionStreamNew> path = permissionStreamNewService |
| | | .list(new QueryWrapper<PermissionStreamNew>().in("business_id",ids) |
| | | .eq("delete_flag",0)); |
| | | path.forEach(item->{ |
| | | if (item.getDepartId()!=null){ |
| | | MdcProduction mdcProduction=mdcProductionService.getById(item.getDepartId()); |
| | | if(mdcProduction!=null){ |
| | | item.setDepartId(item.getDepartId()); |
| | | } |
| | | } |
| | | if (item.getUserId()!=null){ |
| | | item.setUserId(sysUserService.getById(item.getUserId()).getUsername()); |
| | | } |
| | | }); |
| | | return path; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.dnc.service.impl; |
| | | |
| | | import org.jeecg.modules.dnc.dto.TransferPackage; |
| | | import org.jeecg.modules.dnc.entity.DocRelative; |
| | | import org.jeecg.modules.dnc.entity.PartsInfo; |
| | | import org.jeecg.modules.dnc.mapper.DeviceTypeMapper; |
| | | import org.jeecg.modules.dnc.mapper.DocRelativeMapper; |
| | | import org.jeecg.modules.dnc.mapper.PartsInfoMapper; |
| | | import org.jeecg.modules.dnc.service.DataPackageStrategy; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class PartsPackageStrategy implements DataPackageStrategy { |
| | | @Autowired |
| | | private PartsInfoMapper partsInfoMapper; |
| | | @Autowired |
| | | private DeviceTypeMapper deviceTypeMapper; |
| | | @Autowired |
| | | private FullHierarchyTraceService traceService; |
| | | @Autowired |
| | | private DocRelativeMapper docRelativeMapper; |
| | | |
| | | @Override |
| | | public TransferPackage packageData(String relativeId) { |
| | | DocRelative docRelative=docRelativeMapper.selectById(relativeId); |
| | | PartsInfo partsInfo=partsInfoMapper.selectById(docRelative.getAttributionId()); |
| | | if (partsInfo == null) { |
| | | throw new IllegalArgumentException("对åºçé¶ä»¶ä¸åå¨: " + docRelative.getAttributionId()); |
| | | } |
| | | return TransferPackage.builder() |
| | | .dataType(TransferPackage.DataType.PARTS) |
| | | .docRelative(docRelative) |
| | | .traceChain(traceService.traceFromParts(docRelative)) |
| | | .build(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.dnc.service.impl; |
| | | |
| | | import org.jeecg.modules.dnc.dto.TransferPackage; |
| | | import org.jeecg.modules.dnc.entity.DocRelative; |
| | | import org.jeecg.modules.dnc.entity.ProcessSpecVersion; |
| | | import org.jeecg.modules.dnc.mapper.DeviceTypeMapper; |
| | | import org.jeecg.modules.dnc.mapper.DocRelativeMapper; |
| | | import org.jeecg.modules.dnc.mapper.ProcessSpecVersionMapper; |
| | | import org.jeecg.modules.dnc.service.DataPackageStrategy; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class ProcessSpecVersionPackageStrategy implements DataPackageStrategy { |
| | | @Autowired |
| | | private ProcessSpecVersionMapper processSpecVersionMapper; |
| | | @Autowired |
| | | private DeviceTypeMapper deviceTypeMapper; |
| | | @Autowired |
| | | private FullHierarchyTraceService traceService; |
| | | @Autowired |
| | | private DocRelativeMapper docRelativeMapper; |
| | | |
| | | @Override |
| | | public TransferPackage packageData(String relativeId) { |
| | | DocRelative docRelative=docRelativeMapper.selectById(relativeId); |
| | | ProcessSpecVersion processSpecVersion=processSpecVersionMapper.selectById(docRelative.getAttributionId()); |
| | | if (processSpecVersion == null) { |
| | | throw new IllegalArgumentException("对åºçå·¥èºè§ç¨çæ¬ä¸åå¨: " + docRelative.getAttributionId()); |
| | | } |
| | | return TransferPackage.builder() |
| | | .dataType(TransferPackage.DataType.PROCESS) |
| | | .docRelative(docRelative) |
| | | .traceChain(traceService.traceFromPsv(docRelative)) |
| | | .build(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.dnc.service.impl; |
| | | |
| | | import org.jeecg.modules.dnc.dto.TransferPackage; |
| | | import org.jeecg.modules.dnc.entity.DocRelative; |
| | | import org.jeecg.modules.dnc.entity.ProductInfo; |
| | | import org.jeecg.modules.dnc.mapper.DeviceTypeMapper; |
| | | import org.jeecg.modules.dnc.mapper.DocRelativeMapper; |
| | | import org.jeecg.modules.dnc.mapper.ProductInfoMapper; |
| | | import org.jeecg.modules.dnc.service.DataPackageStrategy; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class ProductPackageStrategy implements DataPackageStrategy { |
| | | @Autowired |
| | | private ProductInfoMapper productInfoMapper; |
| | | @Autowired |
| | | private DeviceTypeMapper deviceTypeMapper; |
| | | @Autowired |
| | | private FullHierarchyTraceService traceService; |
| | | @Autowired |
| | | private DocRelativeMapper docRelativeMapper; |
| | | |
| | | @Override |
| | | public TransferPackage packageData(String relativeId) { |
| | | DocRelative docRelative=docRelativeMapper.selectById(relativeId); |
| | | ProductInfo productInfo=productInfoMapper.selectById(docRelative.getAttributionId()); |
| | | if (productInfo == null) { |
| | | throw new IllegalArgumentException("对åºç产åä¸åå¨: " + docRelative.getAttributionId()); |
| | | } |
| | | return TransferPackage.builder() |
| | | .dataType(TransferPackage.DataType.PRODUCT) |
| | | .docRelative(docRelative) |
| | | .traceChain(traceService.traceFromProduct(docRelative)) |
| | | .build(); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * å
¶ä»ææ¡£æå¨åèµ·æµç¨ |
| | | * @param dispatchFile |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "ncç¨åºä¸çµåå¾çç¾æ´¾-å
¶ä»ææ¡£æå¨åèµ·æµç¨") |
| | | @ApiOperation(value="ncç¨åºä¸çµåå¾çç¾æ´¾-å
¶ä»ææ¡£æå¨åèµ·æµç¨", notes="ncç¨åºä¸çµåå¾çç¾æ´¾-å
¶ä»ææ¡£æå¨åèµ·æµç¨") |
| | | @PostMapping(value = "/startDispatchFile") |
| | | public Result<?> startDispatchFile(@RequestBody DispatchFile dispatchFile){ |
| | | return dispatchFileService.saveDispatchFile(dispatchFile); |
| | | } |
| | | |
| | | /** |
| | | * éæ°å¯å¨ |
| | | * @param dispatchFileFlowTaskVo |
| | | * @return |
| | |
| | | DocFile docFile = docFileService.getById(en.getFileId()); |
| | | if(docFile == null) |
| | | ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); |
| | | //ä¿®æ¹åæç¶æ |
| | | docInfo.setDocDispatchStatus(4); |
| | | //ä¿®æ¹NCç¶æ |
| | | if (Objects.equals(en.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode().toString()) || |
| | | Objects.equals(en.getAttributionType(), DocAttributionTypeEnum.WORKSITE.getCode().toString())) { |
| | | docInfo.setDocDispatchStatus(4); |
| | | } |
| | | docInfoService.updateById(docInfo); |
| | | DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(en.getDocId(),7, en.getDeviceId()); |
| | | if(deviceDoc != null) { |
| | |
| | | } |
| | | if(!b) |
| | | ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); |
| | | if (mdcEquipment != null) { |
| | | List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); |
| | | if (strings != null && !strings.isEmpty()) { |
| | | String path = StringUtils.join(strings.toArray(), "/"); |
| | | boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(),path + "/"+ mdcEquipment.getEquipmentId(), |
| | | docFile.getFileEncodeName(), |
| | | List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); |
| | | if (strings != null && !strings.isEmpty()) { |
| | | String path = StringUtils.join(strings.toArray(), "/"); |
| | | boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(),path + "/"+ mdcEquipment.getEquipmentId(), |
| | | docFile.getFileEncodeName(), |
| | | docFile.getFileName(),docFile.getFileSuffix()); |
| | | if (!copyFileNc) { |
| | | ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); |
| | | } else { |
| | | FileUtilS.deleteZipFromToSend(path + "/"+ mdcEquipment.getEquipmentId(), |
| | | docFile.getFileName(),docFile.getFileSuffix()); |
| | | if (!copyFileNc) { |
| | | ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); |
| | | } else { |
| | | FileUtilS.deleteZipFromToSend(path + "/"+ mdcEquipment.getEquipmentId(), |
| | | docFile.getFileName(),docFile.getFileSuffix()); |
| | | } |
| | | } |
| | | } |
| | | List<DocRelative> docRelativeList=docRelativeService. |
| | |
| | | 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); |
| | | DocRelative docRelative=docRelativeList.get(0); |
| | | if (!Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode()) || |
| | | !Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.WORKSITE.getCode())) { |
| | | //å
¶ä»æä»¶çæ·è´ |
| | | handleFileOtherProcessing(docFile, mdcEquipment, secretFolder); |
| | | //对åºäº§åç»ææ æ·è´ |
| | | handleProductTree(docInfo,docRelativeList.get(0),mdcEquipment.getEquipmentId()); |
| | | } |
| | | return true; |
| | | }else if(up.getStatus() == 3) { |
| | | //æç»æä½ ä»ä¹ä¹ä¸å |
| | | return true; |
| | |
| | | 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); |
| | | String filePath=""; |
| | | switch (docInfo.getAttributionType()){ |
| | | case 1: |
| | | //产å对åºå
¶ä»ææ¡£ |
| | | filePath = ferryService.exportData(TransferPackage.DataType.PRODUCT, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry"); |
| | | System.out.println("äº§åæ°æ®å·²å¯¼åº: " + filePath); |
| | | break; |
| | | case 2: |
| | | //é¨ä»¶å¯¹åºå
¶ä»ææ¡£ |
| | | filePath = ferryService.exportData(TransferPackage.DataType.COMPONENT, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry"); |
| | | System.out.println("é¨ä»¶æ°æ®å·²å¯¼åº: " + filePath); |
| | | break; |
| | | case 3: |
| | | //é¶ä»¶å¯¹åºå
¶ä»ææ¡£ |
| | | filePath = ferryService.exportData(TransferPackage.DataType.PARTS, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry"); |
| | | System.out.println("é¶ä»¶æ°æ®å·²å¯¼åº: " + filePath); |
| | | break; |
| | | case 4: |
| | | //å·¥èºçæ¬å¯¹åºå
¶ä»ææ¡£ |
| | | filePath = ferryService.exportData(TransferPackage.DataType.OPERATION, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry"); |
| | | System.out.println("å·¥èºçæ¬æ°æ®å·²å¯¼åº: " + filePath); |
| | | break; |
| | | case 5: |
| | | //å·¥åºå¯¹åºè®¾å¤ç±» |
| | | filePath = ferryService.exportData(TransferPackage.DataType.PROCESS, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry"); |
| | | System.out.println("å·¥åºæ°æ®å·²å¯¼åº: " + filePath); |
| | | break; |
| | | case 6: |
| | | //å·¥æ¥å¯¹åºè®¾å¤ç±» |
| | | filePath = ferryService.exportData(TransferPackage.DataType.WORKSTEP, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry"); |
| | | System.out.println("å·¥æ¥æ°æ®å·²å¯¼åº: " + filePath); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //å°è£
å¤çå
¶ä»æä»¶ |
| | | private void handleFileOtherProcessing(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(); |
| | | 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(), docFile.getFileSuffix()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void afterFlowHandle(FlowMyBusiness business) { |
| | | business.getTaskNameId();//æ¥ä¸æ¥å®¡æ¹çèç¹ |
| | |
| | | String PCR0006 = "PCR0006"; |
| | | //å¤ä»¶ç®¡çå |
| | | String PCR0007 = "PCR0007"; |
| | | //åä½é¢å¯¼ |
| | | String PCR0008 = "PCR0008"; |
| | | //å
¬å¸é¢å¯¼ |
| | | String PCR0009 = "PCR0009"; |
| | | |
| | | } |
| | |
| | | |
| | | public enum EquipmentLeanOutStatusEnum { |
| | | WAIT_SUBMIT, //å¾
æäº¤ |
| | | WAIT_APPROVAL, //å¾
å®¡æ¹ |
| | | WAIT_APPROVAL_OUT, //å¾
使ç¨åä½åºåå®¡æ¹ |
| | | WAIT_APPROVAL_IN, //å¾
å
¥åå®¡æ¹ |
| | | WAIT_RETURN, //å¾
å½è¿ |
| | | WAIT_CONFIRM, //å¾
确认 |
| | | WAIT_CONFIRM_RETURN, //å¾
å½è¿æ¹ç¡®è®¤ |
| | | WAIT_CONFIRM_BORROW, //å¾
åç¨æ¹ç¡®è®¤ |
| | | REJECT, //已驳å |
| | | COMPLETE, //已宿 |
| | | ; |
| | | public static EquipmentLeanOutStatusEnum getInstance(String code) { |
| | |
| | | */ |
| | | public enum EquipmentTransferStatusEnum { |
| | | WAIT_SUBMIT, //å¾
æäº¤ |
| | | WAIT_CHECK, //å¾
å®¡æ ¸ |
| | | WAIT_USE_LEADER_CHECK, //å¾
使ç¨åä½é¢å¯¼å®¡æ¹ |
| | | WAIT_TRANSFER_LEADER_CHECK, //å¾
è°å
¥åä½é¢å¯¼å®¡æ¹ |
| | | WAIT_EXTERNAL_CONFIRM, //å¾
æºå¨å确认人 |
| | | WAIT_COMPANY_LEADER_CHECK, //å¾
å
¬å¸é¢å¯¼å®¡æ¹ |
| | | REJECT, //已驳å |
| | | COMPLETE, //已宿 |
| | | ; |
| | | |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Description: 设å¤ååºå½è¿ |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-05-13 |
| | | * @Date: 2025-05-13 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Data |
| | | @TableName("eam_equipment_lean_out") |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "eam_equipment_lean_out对象", description = "设å¤ååºå½è¿") |
| | | @ApiModel(value="eam_equipment_lean_out对象", description="设å¤ååºå½è¿") |
| | | public class EamEquipmentLeanOut implements Serializable { |
| | | |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | /**主é®*/ |
| | | @TableId(type = IdType.ASSIGN_ID) |
| | | @ApiModelProperty(value = "主é®") |
| | | private String id; |
| | | /** |
| | | * å建人 |
| | | */ |
| | | /**å建人*/ |
| | | @ApiModelProperty(value = "å建人") |
| | | private String createBy; |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | /**å建æ¶é´*/ |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | private Date createTime; |
| | | /** |
| | | * æ´æ°äºº |
| | | */ |
| | | /**æ´æ°äºº*/ |
| | | @ApiModelProperty(value = "æ´æ°äºº") |
| | | private String updateBy; |
| | | /** |
| | | * æ´æ°æ¶é´ |
| | | */ |
| | | /**æ´æ°æ¶é´*/ |
| | | @ApiModelProperty(value = "æ´æ°æ¶é´") |
| | | private Date updateTime; |
| | | /** |
| | | * å 餿 è®° |
| | | */ |
| | | /**å 餿 è®°*/ |
| | | @ApiModelProperty(value = "å 餿 è®°") |
| | | private Integer delFlag; |
| | | /** |
| | | * 设å¤ID |
| | | */ |
| | | /**设å¤ID*/ |
| | | @ApiModelProperty(value = "设å¤ID") |
| | | private String equipmentId; |
| | | /** |
| | | * åæ®å· |
| | | */ |
| | | /**åæ®å·*/ |
| | | @Excel(name = "åæ®å·", width = 15) |
| | | @ApiModelProperty(value = "åæ®å·") |
| | | private String code; |
| | | /** |
| | | * åå
¥é¨é¨ |
| | | */ |
| | | /**åå
¥é¨é¨*/ |
| | | @Excel(name = "åå
¥é¨é¨", width = 15, dictTable = "mdc_production", dicText = "production_name", dicCode = "id") |
| | | @ApiModelProperty(value = "åå
¥é¨é¨") |
| | | @Dict(dicCode = "mdc_production, production_name, id") |
| | | private String leanDepartId; |
| | | /** |
| | | * åå
¥è´£ä»»äºº |
| | | */ |
| | | /**åå
¥è´£ä»»äºº*/ |
| | | @Excel(name = "åå
¥è´£ä»»äºº", width = 15) |
| | | @ApiModelProperty(value = "åå
¥è´£ä»»äºº") |
| | | @Dict(dicCode = "sys_user, realname, username") |
| | | private String leanPerson; |
| | | /** |
| | | * åç¨åå |
| | | */ |
| | | /**åç¨åå */ |
| | | @ApiModelProperty(value = "åç¨åå ") |
| | | private String leanReason; |
| | | /** |
| | | * 审æ¹ç±»å |
| | | */ |
| | | @ApiModelProperty(value = "审æ¹ç±»å") |
| | | @Dict(dicCode = "approved_rejected") |
| | | private String approvalDealType; |
| | | /** |
| | | * ååºç¶æ |
| | | */ |
| | | /**ååºç¶æ*/ |
| | | @Excel(name = "ååºç¶æ", width = 15) |
| | | @ApiModelProperty(value = "ååºç¶æ") |
| | | @Dict(dicCode = "equipment_lean_out_status") |
| | | private String leanStatus; |
| | | /** |
| | | * ååºå¼å§æ¶é´ |
| | | */ |
| | | /**ååºå¼å§æ¶é´*/ |
| | | @ApiModelProperty(value = "ååºæ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date leanStartTime; |
| | | /** |
| | | * ååºå½è¿æ¶é´ |
| | | */ |
| | | /**ååºå½è¿æ¶é´*/ |
| | | @ApiModelProperty(value = "å½è¿æ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date leanEndTime; |
| | | /** |
| | | * å®¡æ ¸äºº |
| | | */ |
| | | @Excel(name = "å®¡æ ¸äºº", width = 15) |
| | | @ApiModelProperty(value = "å®¡æ ¸äºº") |
| | | /**使ç¨è½¦é´å®¡æ ¸äºº*/ |
| | | @Excel(name = "使ç¨è½¦é´å®¡æ ¸äºº", width = 15) |
| | | @ApiModelProperty(value = "使ç¨è½¦é´å®¡æ ¸äºº") |
| | | @Dict(dicCode = "sys_user, realname, username") |
| | | private String approvalUser; |
| | | /** |
| | | * å®¡æ ¸æè§ |
| | | */ |
| | | @Excel(name = "å®¡æ ¸æè§", width = 15) |
| | | @ApiModelProperty(value = "å®¡æ ¸æè§") |
| | | private String approvalComment; |
| | | /** |
| | | * å®¡æ ¸æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "å®¡æ ¸æ¶é´") |
| | | private String useApprovalUser; |
| | | /**使ç¨è½¦é´å®¡æ¹ç±»å*/ |
| | | @ApiModelProperty(value = "使ç¨è½¦é´å®¡æ¹ç±»å") |
| | | @Dict(dicCode = "approved_rejected") |
| | | private String useApprovalDealType; |
| | | /**使ç¨è½¦é´å®¡æ ¸æè§*/ |
| | | @Excel(name = "使ç¨è½¦é´å®¡æ ¸æè§", width = 15) |
| | | @ApiModelProperty(value = "使ç¨è½¦é´å®¡æ ¸æè§") |
| | | private String useApprovalComment; |
| | | /**使ç¨è½¦é´å®¡æ ¸æ¶é´*/ |
| | | @ApiModelProperty(value = "使ç¨è½¦é´å®¡æ ¸æ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date approvalTime; |
| | | /** |
| | | * 确认人 |
| | | */ |
| | | @Excel(name = "确认人", width = 15) |
| | | @ApiModelProperty(value = "确认人") |
| | | private Date useApprovalTime; |
| | | |
| | | /**åç¨è½¦é´å®¡æ ¸äºº*/ |
| | | @Excel(name = "åç¨è½¦é´å®¡æ ¸äºº", width = 15) |
| | | @ApiModelProperty(value = "åç¨è½¦é´å®¡æ ¸äºº") |
| | | @Dict(dicCode = "sys_user, realname, username") |
| | | private String confirmUser; |
| | | /** |
| | | * 确认æè§ |
| | | */ |
| | | @Excel(name = "确认æè§", width = 15) |
| | | @ApiModelProperty(value = "确认æè§") |
| | | private String confirmComment; |
| | | /** |
| | | * 确认æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "确认æ¶é´") |
| | | private String leanOutApprovalUser; |
| | | /**åç¨è½¦é´å®¡æ¹ç±»å*/ |
| | | @ApiModelProperty(value = "åç¨è½¦é´å®¡æ¹ç±»å") |
| | | @Dict(dicCode = "approved_rejected") |
| | | private String leanOutApprovalDealType; |
| | | /**åç¨è½¦é´å®¡æ ¸æè§*/ |
| | | @Excel(name = "åç¨è½¦é´å®¡æ ¸æè§", width = 15) |
| | | @ApiModelProperty(value = "使ç¨è½¦é´å®¡æ ¸æè§") |
| | | private String leanOutApprovalComment; |
| | | /**åç¨è½¦é´å®¡æ ¸æ¶é´*/ |
| | | @ApiModelProperty(value = "åç¨è½¦é´å®¡æ ¸æ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date confirmTime; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private Date leanOutApprovalTime; |
| | | |
| | | /**使ç¨è½¦é´ç¡®è®¤äºº*/ |
| | | @Excel(name = "使ç¨è½¦é´ç¡®è®¤äºº", width = 15) |
| | | @ApiModelProperty(value = "使ç¨è½¦é´ç¡®è®¤äºº") |
| | | @Dict(dicCode = "sys_user, realname, username") |
| | | private String useConfirmUser; |
| | | /**确认æè§*/ |
| | | @Excel(name = "使ç¨è½¦é´ç¡®è®¤æè§", width = 15) |
| | | @ApiModelProperty(value = "使ç¨è½¦é´ç¡®è®¤æè§") |
| | | private String useConfirmComment; |
| | | /**使ç¨è½¦é´ç¡®è®¤æ¶é´*/ |
| | | @ApiModelProperty(value = "使ç¨è½¦é´ç¡®è®¤æ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date useConfirmTime; |
| | | /**åç¨è½¦é´ç¡®è®¤äºº*/ |
| | | @Excel(name = "åç¨è½¦é´ç¡®è®¤äºº", width = 15) |
| | | @ApiModelProperty(value = "åç¨è½¦é´ç¡®è®¤äºº") |
| | | @Dict(dicCode = "sys_user, realname, username") |
| | | private String leanOutConfirmUser; |
| | | /**åç¨è½¦é´ç¡®è®¤æè§*/ |
| | | @Excel(name = "åç¨è½¦é´ç¡®è®¤æè§", width = 15) |
| | | @ApiModelProperty(value = "åç¨è½¦é´ç¡®è®¤æè§") |
| | | private String leanOutConfirmComment; |
| | | /**åç¨è½¦é´ç¡®è®¤æ¶é´*/ |
| | | @ApiModelProperty(value = "åç¨è½¦é´ç¡®è®¤æ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date leanOutConfirmTime; |
| | | /**夿³¨*/ |
| | | @Excel(name = "夿³¨", width = 15) |
| | | @ApiModelProperty(value = "夿³¨") |
| | | private String remark; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | /**夿³¨*/ |
| | | @Excel(name = "å½è¿å¤æ³¨", width = 15) |
| | | @ApiModelProperty(value = "å½è¿å¤æ³¨") |
| | | private String returnComment; |
| | |
| | | package org.jeecg.modules.eam.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecg.common.aspect.annotation.Dict; |
| | | import org.jeecg.common.system.base.entity.JeecgEntity; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "eam_equipment_transfer对象", description = "设å¤å½å±åå¨") |
| | | public class EamEquipmentTransfer implements Serializable { |
| | | public class EamEquipmentTransfer extends JeecgEntity implements Serializable { |
| | | |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | @TableId(type = IdType.ASSIGN_ID) |
| | | @ApiModelProperty(value = "主é®") |
| | | private String id; |
| | | /** |
| | | * å建人 |
| | | */ |
| | | @Excel(name = "å建人", width = 15) |
| | | @ApiModelProperty(value = "å建人") |
| | | private String createBy; |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | private Date createTime; |
| | | /** |
| | | * æ´æ°äºº |
| | | */ |
| | | @Excel(name = "æ´æ°äºº", width = 15) |
| | | @ApiModelProperty(value = "æ´æ°äºº") |
| | | private String updateBy; |
| | | /** |
| | | * æ´æ°æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "æ´æ°æ¶é´") |
| | | private Date updateTime; |
| | | private static final long serialVersionUID = -1869845900682810093L; |
| | | |
| | | /** |
| | | * å 餿 è®° |
| | | */ |
| | |
| | | @ApiModelProperty(value = "å卿¥æ") |
| | | private Date transferTime; |
| | | /** |
| | | * å®¡æ ¸äºº |
| | | * 使ç¨åä½é¢å¯¼ |
| | | */ |
| | | @Excel(name = "å®¡æ ¸äºº", width = 15) |
| | | @ApiModelProperty(value = "å®¡æ ¸äºº") |
| | | @Excel(name = "使ç¨åä½é¢å¯¼", width = 15) |
| | | @ApiModelProperty(value = "使ç¨åä½é¢å¯¼") |
| | | @Dict(dicCode = "sys_user, realname, username") |
| | | private String approvalUser; |
| | | private String useLeader; |
| | | /** |
| | | * å®¡æ ¸ç±»å |
| | | * 使ç¨åä½é¢å¯¼å®¡æ ¸ç±»å |
| | | */ |
| | | @ApiModelProperty(value = "å®¡æ ¸ç±»å") |
| | | @ApiModelProperty(value = "使ç¨åä½é¢å¯¼å®¡æ ¸ç±»å") |
| | | @Dict(dicCode = "approved_rejected") |
| | | private String approvalDealType; |
| | | private String useLeaderApprovalDealType; |
| | | /** |
| | | * å®¡æ ¸æè§ |
| | | * 使ç¨åä½é¢å¯¼å®¡æ ¸æè§ |
| | | */ |
| | | @ApiModelProperty(value = "å®¡æ ¸æè§") |
| | | private String approvalComment; |
| | | @ApiModelProperty(value = "使ç¨åä½é¢å¯¼å®¡æ ¸æè§") |
| | | private String useLeaderApprovalComment; |
| | | /** |
| | | * å®¡æ ¸æ¶é´ |
| | | * 使ç¨åä½é¢å¯¼å®¡æ ¸æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "å®¡æ ¸æ¶é´") |
| | | private Date approvalTime; |
| | | @ApiModelProperty(value = "使ç¨åä½é¢å¯¼å®¡æ ¸æ¶é´") |
| | | private Date useLeaderApprovalTime; |
| | | /** |
| | | * è°å
¥åä½é¢å¯¼ |
| | | */ |
| | | @Excel(name = "è°å
¥åä½é¢å¯¼", width = 15) |
| | | @ApiModelProperty(value = "è°å
¥åä½é¢å¯¼") |
| | | @Dict(dicCode = "sys_user, realname, username") |
| | | private String transferLeader; |
| | | /** |
| | | * è°å
¥åä½é¢å¯¼å®¡æ ¸ç±»å |
| | | */ |
| | | @ApiModelProperty(value = "è°å
¥åä½é¢å¯¼å®¡æ ¸ç±»å") |
| | | @Dict(dicCode = "approved_rejected") |
| | | private String transferLeaderApprovalDealType; |
| | | /** |
| | | * è°å
¥åä½é¢å¯¼å®¡æ ¸æè§ |
| | | */ |
| | | @ApiModelProperty(value = "è°å
¥åä½é¢å¯¼å®¡æ ¸æè§") |
| | | private String transferLeaderApprovalComment; |
| | | /** |
| | | * è°å
¥åä½é¢å¯¼å®¡æ ¸æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "è°å
¥åä½é¢å¯¼å®¡æ ¸æ¶é´") |
| | | private Date transferLeaderApprovalTime; |
| | | /** |
| | | * æºå¨å确认人 |
| | | */ |
| | | @Excel(name = "æºå¨å确认人", width = 15) |
| | | @ApiModelProperty(value = "æºå¨å确认人") |
| | | @Dict(dicCode = "sys_user, realname, username") |
| | | private String externalConfirm; |
| | | /** |
| | | * æºå¨å确认æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "æºå¨å确认æ¶é´") |
| | | private Date externalConfirmTime; |
| | | /** |
| | | * æ¯å¦éè¦å
¬å¸é¢å¯¼å®¡æ¹ |
| | | */ |
| | | @Excel(name = "æ¯å¦éè¦å
¬å¸é¢å¯¼å®¡æ¹", width = 15) |
| | | @ApiModelProperty(value = "æ¯å¦éè¦å
¬å¸é¢å¯¼å®¡æ¹") |
| | | @Dict(dicCode = "yn") |
| | | private String companyLeaderCheck; |
| | | |
| | | /** |
| | | * å
¬å¸é¢å¯¼ |
| | | */ |
| | | @Excel(name = "å
¬å¸é¢å¯¼", width = 15) |
| | | @ApiModelProperty(value = "å
¬å¸é¢å¯¼") |
| | | @Dict(dicCode = "sys_user, realname, username") |
| | | private String companyLeader; |
| | | /** |
| | | * å
¬å¸é¢å¯¼å®¡æ ¸ç±»å |
| | | */ |
| | | @ApiModelProperty(value = "å
¬å¸é¢å¯¼å®¡æ ¸ç±»å") |
| | | @Dict(dicCode = "approved_rejected") |
| | | private String companyLeaderApprovalDealType; |
| | | /** |
| | | * å
¬å¸é¢å¯¼å®¡æ ¸æè§ |
| | | */ |
| | | @ApiModelProperty(value = "å
¬å¸é¢å¯¼å®¡æ ¸æè§") |
| | | private String companyLeaderApprovalComment; |
| | | /** |
| | | * å
¬å¸é¢å¯¼å®¡æ ¸æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "å
¬å¸é¢å¯¼å®¡æ ¸æ¶é´") |
| | | private Date companyLeaderApprovalTime; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
| | | EamEquipmentTransfer entity = eamEquipmentTransferService.getById(id); |
| | | if (entity != null) { |
| | | entity.setDelFlag(CommonConstant.DEL_FLAG_1); |
| | | eamEquipmentTransferService.updateById(entity); |
| | | if (entity != null && !EquipmentTransferStatusEnum.WAIT_SUBMIT.name().equals(entity.getTransferStatus())) { |
| | | eamEquipmentTransferService.removeById(entity); |
| | | } |
| | | return Result.OK("å 餿å!"); |
| | | } |
| | |
| | | @ApiOperation(value = "设å¤å½å±åå¨-æ¹éå é¤", notes = "设å¤å½å±åå¨-æ¹éå é¤") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
| | | this.eamEquipmentTransferService.removeByIds(Arrays.asList(ids.split(","))); |
| | | List<String> list = Arrays.asList(ids.split(",")); |
| | | list.forEach(id -> { |
| | | EamEquipmentTransfer entity = eamEquipmentTransferService.getById(id); |
| | | if (entity != null) { |
| | | if (entity != null && !EquipmentTransferStatusEnum.WAIT_SUBMIT.name().equals(entity.getTransferStatus())) { |
| | | entity.setDelFlag(CommonConstant.DEL_FLAG_1); |
| | | eamEquipmentTransferService.updateById(entity); |
| | | eamEquipmentTransferService.removeById(entity); |
| | | } |
| | | }); |
| | | return Result.OK("æ¹éå 餿åï¼"); |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | |
| | | |
| | | @ApiOperation(value = "ç²¾åº¦åæ°ç»´æ¤-æ¥è¯¢ææ", notes = "ç²¾åº¦åæ°ç»´æ¤-æ¥è¯¢ææ") |
| | | @GetMapping(value = "/listAll") |
| | | public Result<?> listAll() { |
| | | public Result<?> listAll(String equipmentType) { |
| | | QueryWrapper<EamPrecisionParameters> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("del_flag", CommonConstant.DEL_FLAG_0); |
| | | queryWrapper.eq(StringUtils.isNotEmpty(equipmentType), "equipment_type", equipmentType); |
| | | List<EamPrecisionParameters> list = eamPrecisionParametersService.list(queryWrapper); |
| | | return Result.OK(list); |
| | | } |
| | |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.DateUtils; |
| | | import org.jeecg.modules.eam.constant.BusinessCodeConst; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentLeanOut; |
| | | import org.jeecg.modules.eam.entity.EamSparePartRequisition; |
| | | import org.jeecg.modules.eam.entity.EamSparePartRequisitionDetail; |
| | | import org.jeecg.modules.eam.request.EamEquipmentLeanOutRequest; |
| | | import org.jeecg.modules.eam.request.EamSparePartRequisitionRequest; |
| | | import org.jeecg.modules.eam.service.IEamSparePartRequisitionDetailService; |
| | | import org.jeecg.modules.eam.service.IEamSparePartRequisitionService; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | |
| | | import org.jeecg.modules.system.service.ISysBusinessCodeRuleService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | import io.swagger.annotations.Api; |
| | |
| | | @ApiModelProperty(value = "åæ°åç±»") |
| | | @Dict(dicCode = "precision_parameters_category") |
| | | private String parameterCategory; |
| | | /** |
| | | * 设å¤ç§ç±» |
| | | */ |
| | | @Excel(name = "设å¤ç§ç±»", width = 15, dictTable = "sys_category", dicCode = "code", dicText = "name") |
| | | @ApiModelProperty(value = "设å¤ç§ç±»") |
| | | @Dict(dictTable = "sys_category", dicCode = "code", dicText = "name") |
| | | private String equipmentType; |
| | | } |
| | |
| | | package org.jeecg.modules.eam.mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentLeanOut; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentSealUp; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentSealUp; |
| | | |
| | | /** |
| | | * @Description: 设å¤å°åå¯å° |
| | |
| | | * å建æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | /** |
| | | * æ´æ°äºº |
| | |
| | | * æ´æ°æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "æ´æ°æ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | /** |
| | | * å 餿 è®° |
| | |
| | | /** |
| | | * åæ®å· |
| | | */ |
| | | @Excel(name = "åæ®å·", width = 15) |
| | | @ApiModelProperty(value = "åæ®å·") |
| | | private String code; |
| | | /** |
| | | * åå
¥é¨é¨ |
| | | */ |
| | | @Excel(name = "åå
¥é¨é¨", width = 15, dictTable = "mdc_production", dicText = "production_name", dicCode = "id") |
| | | @ApiModelProperty(value = "åå
¥é¨é¨") |
| | | @Dict(dicCode = "mdc_production, production_name, id") |
| | | private String leanDepartId; |
| | | /** |
| | | * åå
¥è´£ä»»äºº |
| | | */ |
| | | @Excel(name = "åå
¥è´£ä»»äºº", width = 15) |
| | | @ApiModelProperty(value = "åå
¥è´£ä»»äºº") |
| | | @Dict(dicCode = "sys_user, realname, username") |
| | | private String leanPerson; |
| | | /** |
| | | * åç¨åå |
| | |
| | | @ApiModelProperty(value = "åç¨åå ") |
| | | private String leanReason; |
| | | /** |
| | | * 审æ¹ç±»å |
| | | */ |
| | | @ApiModelProperty(value = "审æ¹ç±»å") |
| | | @Dict(dicCode = "approved_rejected") |
| | | private String approvalDealType; |
| | | /** |
| | | * ååºç¶æ |
| | | */ |
| | | @Excel(name = "ååºç¶æ", width = 15) |
| | | @ApiModelProperty(value = "ååºç¶æ") |
| | | @Dict(dicCode = "equipment_lean_out_status") |
| | | private String leanStatus; |
| | | /** |
| | | * ååºå¼å§æ¶é´ |
| | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date leanEndTime; |
| | | /** |
| | | * å®¡æ ¸äºº |
| | | * 使ç¨è½¦é´å®¡æ ¸äºº |
| | | */ |
| | | @Excel(name = "å®¡æ ¸äºº", width = 15) |
| | | @ApiModelProperty(value = "å®¡æ ¸äºº") |
| | | @Dict(dicCode = "sys_user, realname, username") |
| | | private String approvalUser; |
| | | @ApiModelProperty(value = "使ç¨è½¦é´å®¡æ ¸äºº") |
| | | private String useApprovalUser; |
| | | /** |
| | | * å®¡æ ¸æè§ |
| | | * 使ç¨è½¦é´å®¡æ¹ç±»å |
| | | */ |
| | | @Excel(name = "å®¡æ ¸æè§", width = 15) |
| | | @ApiModelProperty(value = "å®¡æ ¸æè§") |
| | | private String approvalComment; |
| | | @ApiModelProperty(value = "使ç¨è½¦é´å®¡æ¹ç±»å") |
| | | private String useApprovalDealType; |
| | | /** |
| | | * å®¡æ ¸æ¶é´ |
| | | * 使ç¨è½¦é´å®¡æ ¸æè§ |
| | | */ |
| | | @ApiModelProperty(value = "å®¡æ ¸æ¶é´") |
| | | @ApiModelProperty(value = "使ç¨è½¦é´å®¡æ ¸æè§") |
| | | private String useApprovalComment; |
| | | /** |
| | | * 使ç¨è½¦é´å®¡æ ¸æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "使ç¨è½¦é´å®¡æ ¸æ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date approvalTime; |
| | | private Date useApprovalTime; |
| | | |
| | | /** |
| | | * 确认人 |
| | | * åç¨è½¦é´å®¡æ ¸äºº |
| | | */ |
| | | @Excel(name = "确认人", width = 15) |
| | | @ApiModelProperty(value = "确认人") |
| | | @Dict(dicCode = "sys_user, realname, username") |
| | | private String confirmUser; |
| | | @ApiModelProperty(value = "åç¨è½¦é´å®¡æ ¸äºº") |
| | | private String leanOutApprovalUser; |
| | | /** |
| | | * åç¨è½¦é´å®¡æ¹ç±»å |
| | | */ |
| | | @ApiModelProperty(value = "åç¨è½¦é´å®¡æ¹ç±»å") |
| | | private String leanOutApprovalDealType; |
| | | /** |
| | | * åç¨è½¦é´å®¡æ ¸æè§ |
| | | */ |
| | | @ApiModelProperty(value = "使ç¨è½¦é´å®¡æ ¸æè§") |
| | | private String leanOutApprovalComment; |
| | | /** |
| | | * åç¨è½¦é´å®¡æ ¸æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "åç¨è½¦é´å®¡æ ¸æ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date leanOutApprovalTime; |
| | | |
| | | /** |
| | | * 使ç¨è½¦é´ç¡®è®¤äºº |
| | | */ |
| | | @ApiModelProperty(value = "使ç¨è½¦é´ç¡®è®¤äºº") |
| | | private String useConfirmUser; |
| | | /** |
| | | * 确认æè§ |
| | | */ |
| | | @Excel(name = "确认æè§", width = 15) |
| | | @ApiModelProperty(value = "确认æè§") |
| | | private String confirmComment; |
| | | @ApiModelProperty(value = "使ç¨è½¦é´ç¡®è®¤æè§") |
| | | private String useConfirmComment; |
| | | /** |
| | | * 确认æ¶é´ |
| | | * 使ç¨è½¦é´ç¡®è®¤æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "确认æ¶é´") |
| | | @ApiModelProperty(value = "使ç¨è½¦é´ç¡®è®¤æ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date confirmTime; |
| | | private Date useConfirmTime; |
| | | /** |
| | | * åç¨è½¦é´ç¡®è®¤äºº |
| | | */ |
| | | @ApiModelProperty(value = "åç¨è½¦é´ç¡®è®¤äºº") |
| | | private String leanOutConfirmUser; |
| | | /** |
| | | * åç¨è½¦é´ç¡®è®¤æè§ |
| | | */ |
| | | @ApiModelProperty(value = "åç¨è½¦é´ç¡®è®¤æè§") |
| | | private String leanOutConfirmComment; |
| | | /** |
| | | * åç¨è½¦é´ç¡®è®¤æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "åç¨è½¦é´ç¡®è®¤æ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date leanOutConfirmTime; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @Excel(name = "夿³¨", width = 15) |
| | | @ApiModelProperty(value = "夿³¨") |
| | | private String remark; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @Excel(name = "å½è¿å¤æ³¨", width = 15) |
| | | @ApiModelProperty(value = "å½è¿å¤æ³¨") |
| | | private String returnComment; |
| | | |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecg.modules.flowable.domain.vo.FlowTaskVo; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | |
| | | @ApiModelProperty(value = "å卿¥æ") |
| | | private Date transferTime; |
| | | /** |
| | | * å®¡æ ¸äºº |
| | | * 使ç¨åä½é¢å¯¼å®¡æ ¸ç±»å |
| | | */ |
| | | @Excel(name = "å®¡æ ¸äºº", width = 15) |
| | | @ApiModelProperty(value = "å®¡æ ¸äºº") |
| | | private String approvalUser; |
| | | @ApiModelProperty(value = "使ç¨åä½é¢å¯¼å®¡æ ¸ç±»å") |
| | | private String useLeaderApprovalDealType; |
| | | /** |
| | | * å®¡æ ¸æ¶é´ |
| | | * 使ç¨åä½é¢å¯¼å®¡æ ¸æè§ |
| | | */ |
| | | @ApiModelProperty(value = "å®¡æ ¸æ¶é´") |
| | | private Date approvalTime; |
| | | @ApiModelProperty(value = "使ç¨åä½é¢å¯¼å®¡æ ¸æè§") |
| | | private String useLeaderApprovalComment; |
| | | /** |
| | | * å®¡æ ¸ç±»å |
| | | * è°å
¥åä½é¢å¯¼å®¡æ ¸ç±»å |
| | | */ |
| | | @Excel(name = "å®¡æ ¸ç±»å", width = 15) |
| | | @ApiModelProperty(value = "å®¡æ ¸ç±»å") |
| | | private String approvalDealType; |
| | | @ApiModelProperty(value = "è°å
¥åä½é¢å¯¼å®¡æ ¸ç±»å") |
| | | private String transferLeaderApprovalDealType; |
| | | /** |
| | | * å®¡æ ¸æè§ |
| | | * è°å
¥åä½é¢å¯¼å®¡æ ¸æè§ |
| | | */ |
| | | @ApiModelProperty(value = "å®¡æ ¸æè§") |
| | | private String approvalComment; |
| | | @ApiModelProperty(value = "è°å
¥åä½é¢å¯¼å®¡æ ¸æè§") |
| | | private String transferLeaderApprovalComment; |
| | | /** |
| | | * æ¯å¦éè¦å
¬å¸é¢å¯¼å®¡æ¹ |
| | | */ |
| | | @ApiModelProperty(value = "æ¯å¦éè¦å
¬å¸é¢å¯¼å®¡æ¹") |
| | | private String companyLeaderCheck; |
| | | /** |
| | | * å
¬å¸é¢å¯¼å®¡æ ¸ç±»å |
| | | */ |
| | | @ApiModelProperty(value = "å
¬å¸é¢å¯¼å®¡æ ¸ç±»å") |
| | | private String companyLeaderApprovalDealType; |
| | | /** |
| | | * å
¬å¸é¢å¯¼å®¡æ ¸æè§ |
| | | */ |
| | | @ApiModelProperty(value = "å
¬å¸é¢å¯¼å®¡æ ¸æè§") |
| | | private String companyLeaderApprovalComment; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentLeanOut; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentLeanOut; |
| | | import org.jeecg.modules.eam.request.EamEquipmentLeanOutQuery; |
| | | import org.jeecg.modules.eam.request.EamEquipmentLeanOutRequest; |
| | | |
| | |
| | | package org.jeecg.modules.eam.service; |
| | | |
| | | import org.jeecg.modules.eam.entity.EamEquipmentLeanOut; |
| | | import org.jeecg.modules.eam.entity.EamSparePartRequisition; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.eam.request.EamEquipmentLeanOutRequest; |
| | | import org.jeecg.modules.eam.request.EamSparePartRequisitionRequest; |
| | | |
| | | import java.util.List; |
| | |
| | | import org.jeecg.modules.eam.constant.*; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentLeanOut; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentSealUp; |
| | | import org.jeecg.modules.eam.mapper.EamEquipmentLeanOutMapper; |
| | | import org.jeecg.modules.eam.request.EamEquipmentLeanOutQuery; |
| | | import org.jeecg.modules.eam.request.EamEquipmentLeanOutRequest; |
| | |
| | | throw new JeecgBootException("å½åç¨æ·æ æ³ç¼è¾åç¨è®°å½ï¼"); |
| | | } |
| | | UpdateWrapper<EamEquipmentLeanOut> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.set("lean_status", EquipmentLeanOutStatusEnum.WAIT_APPROVAL.name()); |
| | | updateWrapper.set("lean_status", EquipmentLeanOutStatusEnum.WAIT_APPROVAL_OUT.name()); |
| | | updateWrapper.eq("id", id); |
| | | updateWrapper.eq("lean_person", sysUser.getUsername()); |
| | | boolean success = super.update(updateWrapper); |
| | |
| | | Result result = flowDefinitionService.startProcessInstanceByKey("equipment_lean_out", variables); |
| | | if (result != null) { |
| | | entity.setLeanStartTime(new Date()); |
| | | entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_APPROVAL.name()); |
| | | entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_APPROVAL_OUT.name()); |
| | | //ä¿åå·¥å |
| | | equipmentLeanOutMapper.updateById(entity); |
| | | return result.isSuccess(); |
| | |
| | | Result result = flowDefinitionService.startProcessInstanceByKey("equipment_return", variables); |
| | | if (result != null) { |
| | | entity.setLeanEndTime(new Date()); |
| | | entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_CONFIRM.name()); |
| | | entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_CONFIRM_RETURN.name()); |
| | | //ä¿åå·¥å |
| | | equipmentLeanOutMapper.updateById(entity); |
| | | return result.isSuccess(); |
| | |
| | | if (user == null || StrUtil.isBlank(user.getId())) { |
| | | throw new JeecgBootException("æªè·åå°ç»å½ç¨æ·ï¼è¯·éæ°ç»å½ååè¯ï¼"); |
| | | } |
| | | request.setApprovalUser(user.getUsername()); |
| | | // request.setApprovalUser(user.getUsername()); |
| | | // è·åæµç¨ä¸å¡è®°å½ |
| | | FlowMyBusiness flowMyBusiness = flowMyBusinessService.getFlowMyBusiness(request.getInstanceId()); |
| | | if (flowMyBusiness == null) { |
| | |
| | | throw new JeecgBootException("设å¤ä¸åå¨ï¼è¯·æ£æ¥ï¼"); |
| | | } |
| | | |
| | | EquipmentLeanOutStatusEnum status = EquipmentLeanOutStatusEnum.getInstance(entity.getLeanStatus()); |
| | | if (status == null) { |
| | | return null; |
| | | } |
| | | //æµç¨åé |
| | | Map<String, Object> values = new HashMap<>(); |
| | | switch (status) { |
| | | // å®¡æ¹ |
| | | case WAIT_APPROVAL: |
| | | //æ§è¡å®æ |
| | | values.put("dataId", entity.getId()); |
| | | values.put("organization", request.getApprovalComment()); |
| | | values.put("comment", request.getApprovalComment()); |
| | | values.put("approvalDealType", request.getApprovalDealType()); |
| | | request.setComment(request.getApprovalComment()); |
| | | entity.setApprovalUser(user.getUsername());// å®¡æ ¸äºº |
| | | entity.setApprovalComment(request.getApprovalComment());// å®¡æ ¸æè§ |
| | | entity.setApprovalTime(new Date());// å®¡æ ¸æ¶é´ |
| | | entity.setApprovalDealType(request.getApprovalDealType()); // 审æ¹ç±»å |
| | | // éªè¯éè¿è¿æ¯é©³å |
| | | if (request.getApprovalDealType().equals("1")) { |
| | | //设置entity |
| | | entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_RETURN.name()); |
| | | List<String> userApprovalList = new ArrayList<>(Collections.singletonList(entity.getLeanPerson())); |
| | | values.put("NextAssignee", userApprovalList); |
| | | } else { |
| | | //设置entity |
| | | entity.setLeanStatus(EquipmentLeanOutStatusEnum.COMPLETE.name()); |
| | | // ä¿®æ¹è®¾å¤ç¶æ |
| | | equipment.setAssetStatus(AssetStatusEnum.NORMAL.name()); |
| | | eamEquipmentService.updateById(equipment); |
| | | } |
| | | break; |
| | | // å½è¿ |
| | | case WAIT_RETURN: |
| | | if (StringUtils.isBlank(equipment.getEquipmentManager())) { |
| | | throw new JeecgBootException("è®¾å¤æªåé
设å¤ç®¡çåï¼æ æ³è¿å
¥ä¸çº§å®¡æ¹ï¼"); |
| | | } |
| | | List<String> userApprovalList = new ArrayList<>(Collections.singletonList(entity.getLeanPerson())); |
| | | userApprovalList.add(equipment.getEquipmentManager()); |
| | | values.put("dataId", entity.getId()); |
| | | values.put("organization", request.getReturnComment()); |
| | | values.put("comment", request.getReturnComment()); |
| | | values.put("NextAssignee", userApprovalList); |
| | | values.put("approvalDealType", "1"); |
| | | request.setComment(request.getReturnComment()); |
| | | entity.setLeanEndTime(new Date()); //å½è¿æ¶é´ |
| | | //设置entity |
| | | entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_CONFIRM.name()); |
| | | entity.setApprovalUser(user.getUsername());// å®¡æ ¸äºº |
| | | entity.setLeanEndTime(new Date());// å½è¿æ¶é´ |
| | | entity.setReturnComment(request.getReturnComment());// å½è¿å¤æ³¨ |
| | | break; |
| | | // å½è¿ç¡®è®¤ |
| | | case WAIT_CONFIRM: |
| | | values.put("approvalDealType", "1"); |
| | | values.put("dataId", entity.getId()); |
| | | values.put("organization", request.getConfirmComment()); |
| | | values.put("comment", request.getConfirmComment()); |
| | | request.setComment(request.getConfirmComment()); |
| | | //设置entity |
| | | entity.setApprovalUser(user.getUsername());// å®¡æ ¸äºº |
| | | entity.setLeanStatus(EquipmentLeanOutStatusEnum.COMPLETE.name()); |
| | | entity.setConfirmUser(user.getUsername()); |
| | | entity.setConfirmComment(request.getConfirmComment()); |
| | | entity.setConfirmTime(new Date()); |
| | | // ä¿®æ¹è®¾å¤ç¶æ0 |
| | | equipment.setAssetStatus(AssetStatusEnum.NORMAL.name()); |
| | | eamEquipmentService.updateById(equipment); |
| | | break; |
| | | } |
| | | request.setValues(values); |
| | | //设置æµç¨åé |
| | | setupProcessVariables(request, entity, user, equipment); |
| | | |
| | | // 宿æµç¨ä»»å¡ |
| | | Result result = flowTaskService.complete(request); |
| | | if (!result.isSuccess()) { |
| | | throw new JeecgBootException("审æ¹å¤±è´¥ï¼è¯·å·æ°æ¥çï¼"); |
| | | } |
| | | |
| | | // æ ¹æ®ä»»å¡å®æç»ææ´æ°å·¥åç¶æ |
| | | updateOrderStatus(result, request, entity, user, equipment); |
| | | |
| | | //ä¿åå·¥å |
| | | equipmentLeanOutMapper.updateById(entity); |
| | | return entity; |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°å·¥åç¶æ |
| | | * @param result |
| | | * @param request |
| | | * @param entity |
| | | * @param user |
| | | * @param equipment |
| | | */ |
| | | private void updateOrderStatus(Result result, EamEquipmentLeanOutRequest request, EamEquipmentLeanOut entity, LoginUser user, EamEquipment equipment) { |
| | | if (result.isSuccess()) { |
| | | EquipmentLeanOutStatusEnum status = EquipmentLeanOutStatusEnum.getInstance(entity.getLeanStatus()); |
| | | switch (status) { |
| | | case WAIT_APPROVAL_OUT: |
| | | entity.setUseApprovalUser(user.getUsername()); |
| | | entity.setUseApprovalComment(request.getUseApprovalComment()); |
| | | entity.setUseApprovalTime(new Date()); |
| | | entity.setUseApprovalDealType(request.getUseApprovalDealType()); |
| | | if (CommonConstant.APPROVED.equals(request.getUseApprovalDealType())) { |
| | | entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_APPROVAL_IN.name()); |
| | | } else { |
| | | entity.setLeanStatus(EquipmentLeanOutStatusEnum.REJECT.name()); |
| | | equipment.setAssetStatus(AssetStatusEnum.LEAN_OUT.name()); |
| | | eamEquipmentService.updateById(equipment); |
| | | } |
| | | request.setComment("使ç¨åä½åºå审æ¹ç»æ"); |
| | | break; |
| | | case WAIT_APPROVAL_IN: |
| | | entity.setLeanOutApprovalUser(user.getUsername()); |
| | | entity.setLeanOutApprovalComment(request.getLeanOutApprovalComment()); |
| | | entity.setLeanOutApprovalTime(new Date()); |
| | | entity.setLeanOutApprovalDealType(request.getLeanOutApprovalDealType()); |
| | | if (CommonConstant.APPROVED.equals(request.getLeanOutApprovalDealType())) { |
| | | entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_RETURN.name()); |
| | | } else { |
| | | entity.setLeanStatus(EquipmentLeanOutStatusEnum.REJECT.name()); |
| | | equipment.setAssetStatus(AssetStatusEnum.LEAN_OUT.name()); |
| | | eamEquipmentService.updateById(equipment); |
| | | } |
| | | request.setComment("åç¨åä½å
¥å审æ¹ç»æ"); |
| | | break; |
| | | case WAIT_CONFIRM_RETURN: |
| | | entity.setLeanOutConfirmUser(user.getUsername()); |
| | | entity.setLeanOutConfirmComment(request.getLeanOutConfirmComment()); |
| | | entity.setLeanOutConfirmTime(new Date()); |
| | | entity.setLeanStatus(EquipmentLeanOutStatusEnum.WAIT_CONFIRM_BORROW.name()); |
| | | request.setComment("åç¨åä½å½è¿å®¡æ¹ç»æ"); |
| | | break; |
| | | case WAIT_CONFIRM_BORROW: |
| | | entity.setUseConfirmUser(user.getUsername()); |
| | | entity.setUseConfirmComment(request.getUseConfirmComment()); |
| | | entity.setUseConfirmTime(new Date()); |
| | | entity.setLeanStatus(EquipmentLeanOutStatusEnum.COMPLETE.name()); |
| | | equipment.setAssetStatus(AssetStatusEnum.NORMAL.name()); |
| | | eamEquipmentService.updateById(equipment); |
| | | request.setComment("使ç¨åä½å½è¿ç¡®è®¤ç»æ"); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°æµç¨ç¶æ |
| | | * |
| | | * @param request |
| | | * @param entity |
| | | * @param user |
| | | * @param equipment |
| | | */ |
| | | private void setupProcessVariables(EamEquipmentLeanOutRequest request, EamEquipmentLeanOut entity, LoginUser user, EamEquipment equipment) { |
| | | Map<String, Object> values = new HashMap<>(); |
| | | List<UserSelector> userSelectors; |
| | | List<String> userApprovalList; |
| | | EquipmentLeanOutStatusEnum status = EquipmentLeanOutStatusEnum.getInstance(entity.getLeanStatus()); |
| | | switch (status) { |
| | | case WAIT_APPROVAL_OUT: |
| | | // 使ç¨åä½åºå审æ¹å®æ |
| | | values.put("dataId", entity.getId()); |
| | | values.put("organization", request.getUseApprovalComment()); |
| | | values.put("comment", request.getUseApprovalComment()); |
| | | if (CommonConstant.APPROVED.equals(request.getUseApprovalDealType())) { |
| | | // éè¿ |
| | | values.put("approvalDealType", request.getUseApprovalDealType()); |
| | | // è·åä¸ä¸æ¥å®¡æ¹äºº |
| | | userSelectors = sysUserService.selectOperatorList(entity.getLeanDepartId(), BusinessCodeConst.PCR0008); |
| | | if (CollectionUtil.isEmpty(userSelectors)) { |
| | | throw new JeecgBootException("æªåé
åç¨è½¦é´åä½é¢å¯¼ï¼æ æ³è¿å
¥ä¸çº§å®¡æ¹ï¼"); |
| | | } |
| | | userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); |
| | | values.put("NextAssignee", userApprovalList); |
| | | } else { |
| | | // 驳å |
| | | values.put("approvalDealType", request.getUseApprovalDealType()); |
| | | } |
| | | break; |
| | | case WAIT_APPROVAL_IN: |
| | | // åç¨åä½å
¥å审æ¹å®æ |
| | | values.put("dataId", entity.getId()); |
| | | values.put("organization", request.getLeanOutApprovalComment()); |
| | | values.put("comment", request.getLeanOutApprovalComment()); |
| | | break; |
| | | case WAIT_CONFIRM_RETURN: |
| | | // å½è¿åä½ç¡®è®¤å®æ |
| | | values.put("dataId", entity.getId()); |
| | | values.put("organization", request.getLeanOutConfirmComment()); |
| | | values.put("comment", request.getLeanOutConfirmComment()); |
| | | // è·åä¸ä¸æ¥å®¡æ¹äºº |
| | | userSelectors = sysUserService.selectOperatorList(equipment.getOrgId(), BusinessCodeConst.PCR0008); |
| | | if (CollectionUtil.isEmpty(userSelectors)) { |
| | | throw new JeecgBootException("æªåé
使ç¨è½¦é´åä½é¢å¯¼ï¼æ æ³è¿å
¥ä¸çº§å®¡æ¹ï¼"); |
| | | } |
| | | userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); |
| | | values.put("NextAssignee", userApprovalList); |
| | | break; |
| | | case WAIT_CONFIRM_BORROW: |
| | | // ååºæ¹ç¡®è®¤å®æ |
| | | values.put("dataId", entity.getId()); |
| | | values.put("organization", request.getUseConfirmComment()); |
| | | values.put("comment", request.getUseConfirmComment()); |
| | | break; |
| | | } |
| | | request.setValues(values); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void afterFlowHandle(FlowMyBusiness business) { |
| | |
| | | //没æéæ©è®¾å¤ï¼æ ¹æ®è½¦é´è¿æ»¤è®¾å¤ |
| | | queryWrapper.exists("select 1 from mdc_user_production t where t.user_id={0} and t.pro_id=e.org_id ", sysUser.getId()); |
| | | } |
| | | //æ§å¶å¾
æäº¤ç¶æçæ°æ®åªè½æ¬äººæ¥ç |
| | | queryWrapper.and(i -> i.ne("wmo.transfer_status", EquipmentTransferStatusEnum.WAIT_SUBMIT).or().eq("wmo.report_user", sysUser.getUsername())); |
| | | // æ§å¶å¾
æäº¤ç¶æçæ°æ®åªè½æ¬äººæ¥ç |
| | | // queryWrapper.and(i -> i.ne("wmo.transfer_status", EquipmentTransferStatusEnum.WAIT_SUBMIT).or().eq("wmo.report_user", sysUser.getUsername())); |
| | | //æ¥è¯¢æ¡ä»¶è¿æ»¤ |
| | | if (query != null) { |
| | | if (StringUtils.isNotBlank(query.getEquipmentId())) { |
| | |
| | | throw new JeecgBootException("å½å设å¤å±äºæ¤è½¦é´ï¼ä¸éè¦åå¨ï¼"); |
| | | } |
| | | request.setOldDepartId(equipment.getOrgId()); |
| | | request.setReportUser(sysUser.getUsername()); |
| | | return equipmentTransferMapper.insert(request) > 0; |
| | | } |
| | | |
| | |
| | | throw new JeecgBootException("è¦æäº¤çæ°æ®ä¸åå¨ï¼è¯·å·æ°éè¯ï¼"); |
| | | } |
| | | if (!EquipmentTransferStatusEnum.WAIT_SUBMIT.name().equals(entity.getTransferStatus())) { |
| | | throw new JeecgBootException("å½åæ°æ®ç¶æä¸å
许ç¼è¾ï¼"); |
| | | throw new JeecgBootException("该工åå·²è¿è¡è¿æäº¤ï¼"); |
| | | } |
| | | //æ£æ¥è®¾å¤ |
| | | EamEquipment equipment = eamEquipmentService.getById(entity.getEquipmentId()); |
| | | if (equipment == null) { |
| | | throw new JeecgBootException("设å¤ä¸åå¨ï¼"); |
| | | throw new JeecgBootException("设å¤ä¸åå¨ï¼æäº¤å¤±è´¥ï¼"); |
| | | } |
| | | // åé
ç»ä½¿ç¨åä½é¢å¯¼ |
| | | List<UserSelector> userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getOrgId(), BusinessCodeConst.PCR0008); |
| | | if (CollectionUtil.isEmpty(userSelectors)) { |
| | | throw new JeecgBootException("è®¾å¤æªåé
ç»åä½é¢å¯¼ï¼æ æ³è¿å
¥ä¸çº§å®¡æ¹ï¼"); |
| | | } |
| | | List<String> usernames = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | throw new JeecgBootException("å½åç¨æ·æ æ³ç¼è¾è½¬è®©è®°å½ï¼"); |
| | | if (sysUser == null || !BusinessCodeConst.PCR0004.equals(sysUser.getPost())) { |
| | | throw new JeecgBootException("䏿¯è®¾å¤ç®¡çåï¼æ æ³æäº¤æ¤å·¥åï¼"); |
| | | } |
| | | UpdateWrapper<EamEquipmentTransfer> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.set("transfer_status", EquipmentSealUpStatusEnum.WAIT_SUBMIT.name()); |
| | | updateWrapper.eq("id", id); |
| | | updateWrapper.eq("report_user", sysUser.getUsername()); |
| | | boolean success = super.update(updateWrapper); |
| | | if (success) { |
| | | equipment.setAssetStatus(AssetStatusEnum.DEALT.name()); // 设å¤è½¬è®© |
| | | eamEquipmentService.updateById(equipment); |
| | | } |
| | | entity.setTransferTime(new Date()); |
| | | entity.setReportUser(sysUser.getUsername()); |
| | | entity.setTransferStatus(EquipmentTransferStatusEnum.WAIT_USE_LEADER_CHECK.name()); |
| | | //ä¿åå·¥å |
| | | equipmentTransferMapper.updateById(entity); |
| | | |
| | | //å¯å¨å®¡æ¹æµç¨ |
| | | flowCommonService.initActBusiness("å·¥åå·:" + entity.getCode() + ";设å¤ç¼å·: " + equipment.getEquipmentCode() + ";è¿è¡è®¾å¤è½¬è®©", |
| | | flowCommonService.initActBusiness("å·¥åå·:" + entity.getCode() + ";设å¤ç¼å·: " + equipment.getEquipmentCode() + ";è¿è¡è®¾å¤è°æ¨", |
| | | entity.getId(), "IEamEquipmentTransferService", "equipment_transfer", null); |
| | | Map<String, Object> variables = new HashMap<>(); |
| | | variables.put("dataId", entity.getId()); |
| | | variables.put("organization", entity.getTransferReason()); |
| | | variables.put("comment", entity.getTransferReason()); |
| | | variables.put("proofreading", true); |
| | | // åé
ç»è®¾å¤ç®¡çå |
| | | List<UserSelector> userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getOrgId(), BusinessCodeConst.PCR0004); |
| | | if (CollectionUtil.isEmpty(userSelectors)) { |
| | | throw new JeecgBootException("è®¾å¤æªåé
ç»è®¾å¤ç®¡çåï¼æ æ³è¿å
¥ä¸çº§å®¡æ¹ï¼"); |
| | | } |
| | | List<String> usernames = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); |
| | | |
| | | variables.put("NextAssignee", usernames); |
| | | Result result = flowDefinitionService.startProcessInstanceByKey("equipment_transfer", variables); |
| | | if (result != null) { |
| | | entity.setTransferTime(new Date()); |
| | | entity.setTransferStatus(EquipmentTransferStatusEnum.WAIT_CHECK.name()); |
| | | //ä¿åå·¥å |
| | | equipmentTransferMapper.updateById(entity); |
| | | equipment.setAssetStatus(AssetStatusEnum.DEALT.name()); // 设å¤è°æ¨ |
| | | eamEquipmentService.updateById(equipment); |
| | | return result.isSuccess(); |
| | | } |
| | | return true; |
| | |
| | | if (user == null || StrUtil.isBlank(user.getId())) { |
| | | throw new JeecgBootException("æªè·åå°ç»å½ç¨æ·ï¼è¯·éæ°ç»å½ååè¯ï¼"); |
| | | } |
| | | request.setApprovalUser(user.getUsername()); |
| | | // è·åæµç¨ä¸å¡è®°å½ |
| | | FlowMyBusiness flowMyBusiness = flowMyBusinessService.getFlowMyBusiness(request.getInstanceId()); |
| | | if (flowMyBusiness == null) { |
| | |
| | | throw new JeecgBootException("设å¤ä¸åå¨ï¼è¯·æ£æ¥ï¼"); |
| | | } |
| | | |
| | | EquipmentTransferStatusEnum status = EquipmentTransferStatusEnum.getInstance(entity.getTransferStatus()); |
| | | if (status == null) { |
| | | return null; |
| | | } |
| | | //æµç¨åé |
| | | Map<String, Object> values = new HashMap<>(); |
| | | // å®¡æ¹ |
| | | if (status == EquipmentTransferStatusEnum.WAIT_CHECK) {//æ§è¡å®æ |
| | | values.put("dataId", entity.getId()); |
| | | values.put("organization", request.getApprovalComment()); |
| | | values.put("comment", request.getApprovalComment()); |
| | | values.put("approvalDealType", request.getApprovalDealType()); |
| | | request.setComment(request.getApprovalComment()); |
| | | entity.setApprovalUser(user.getUsername());// å®¡æ ¸äºº |
| | | entity.setApprovalComment(request.getApprovalComment());// å®¡æ ¸æè§ |
| | | entity.setApprovalTime(new Date());// å®¡æ ¸æ¶é´ |
| | | entity.setApprovalDealType(request.getApprovalDealType()); // 审æ¹ç±»å |
| | | // éªè¯éè¿è¿æ¯é©³å |
| | | if (request.getApprovalDealType().equals("1")) { |
| | | //设置entity |
| | | entity.setTransferStatus(EquipmentTransferStatusEnum.COMPLETE.name()); |
| | | List<String> userApprovalList = new ArrayList<>(Collections.singletonList(entity.getReportUser())); |
| | | values.put("NextAssignee", userApprovalList); |
| | | } else { |
| | | //设置entity |
| | | entity.setTransferStatus(EquipmentTransferStatusEnum.COMPLETE.name()); |
| | | } |
| | | // ä¿®æ¹è®¾å¤ç¶æ |
| | | equipment.setAssetStatus(AssetStatusEnum.NORMAL.name()); |
| | | entity.setApprovalUser(user.getUsername()); |
| | | entity.setApprovalComment(request.getApprovalComment()); |
| | | entity.setApprovalTime(new Date()); |
| | | eamEquipmentService.updateById(equipment); |
| | | } |
| | | request.setValues(values); |
| | | //设置æµç¨åé |
| | | setupProcessVariables(request, entity, user, equipment); |
| | | |
| | | // 宿æµç¨ä»»å¡ |
| | | Result result = flowTaskService.complete(request); |
| | | if (!result.isSuccess()) { |
| | | throw new JeecgBootException("审æ¹å¤±è´¥ï¼è¯·å·æ°æ¥çï¼"); |
| | | } |
| | | |
| | | // æ ¹æ®ä»»å¡å®æç»ææ´æ°å·¥åç¶æ |
| | | updateOrderStatus(result, request, entity, user, equipment); |
| | | |
| | | //ä¿åå·¥å |
| | | equipmentTransferMapper.updateById(entity); |
| | | return entity; |
| | | } |
| | | |
| | | /** |
| | | * 设置工åä¿¡æ¯ |
| | | * |
| | | * @param result |
| | | * @param request |
| | | * @param entity |
| | | * @param user |
| | | */ |
| | | private void updateOrderStatus(Result result, EamEquipmentTransferRequest request, EamEquipmentTransfer entity, LoginUser user, EamEquipment equipment) { |
| | | if (result.isSuccess()) { |
| | | EquipmentTransferStatusEnum status = EquipmentTransferStatusEnum.getInstance(entity.getTransferStatus()); |
| | | switch (status) { |
| | | case WAIT_USE_LEADER_CHECK: |
| | | // 使ç¨åä½é¢å¯¼å®¡æ¹ç»æ |
| | | entity.setUseLeader(user.getUsername()); |
| | | entity.setUseLeaderApprovalComment(request.getUseLeaderApprovalComment()); |
| | | entity.setUseLeaderApprovalTime(new Date()); |
| | | entity.setUseLeaderApprovalDealType(request.getUseLeaderApprovalDealType()); |
| | | if (CommonConstant.APPROVED.equals(request.getUseLeaderApprovalDealType())) { |
| | | entity.setTransferStatus(EquipmentTransferStatusEnum.WAIT_TRANSFER_LEADER_CHECK.name()); |
| | | } else { |
| | | entity.setTransferStatus(EquipmentTransferStatusEnum.REJECT.name()); |
| | | equipment.setAssetStatus(AssetStatusEnum.NORMAL.name()); // 设å¤è°æ¨ |
| | | eamEquipmentService.updateById(equipment); |
| | | } |
| | | break; |
| | | case WAIT_TRANSFER_LEADER_CHECK: |
| | | // è°å
¥åä½é¢å¯¼å®¡æ¹ç»æ |
| | | entity.setTransferLeader(user.getUsername()); |
| | | entity.setTransferLeaderApprovalComment(request.getTransferLeaderApprovalComment()); |
| | | entity.setTransferLeaderApprovalTime(new Date()); |
| | | entity.setTransferLeaderApprovalDealType(request.getTransferLeaderApprovalDealType()); |
| | | if (CommonConstant.APPROVED.equals(request.getTransferLeaderApprovalDealType())) { |
| | | entity.setTransferStatus(EquipmentTransferStatusEnum.WAIT_EXTERNAL_CONFIRM.name()); |
| | | } else { |
| | | entity.setTransferStatus(EquipmentTransferStatusEnum.REJECT.name()); |
| | | equipment.setAssetStatus(AssetStatusEnum.NORMAL.name()); // 设å¤è°æ¨ |
| | | eamEquipmentService.updateById(equipment); |
| | | } |
| | | break; |
| | | case WAIT_EXTERNAL_CONFIRM: |
| | | // æºå¨åç¡®è®¤ç»æ |
| | | entity.setExternalConfirm(user.getUsername()); |
| | | entity.setExternalConfirmTime(new Date()); |
| | | entity.setCompanyLeaderCheck(request.getCompanyLeaderCheck()); |
| | | if (CommonConstant.YN_1.equals(request.getCompanyLeaderCheck())) { |
| | | entity.setTransferStatus(EquipmentTransferStatusEnum.WAIT_COMPANY_LEADER_CHECK.name()); |
| | | } else { |
| | | entity.setTransferStatus(EquipmentTransferStatusEnum.COMPLETE.name()); |
| | | equipment.setOrgId(entity.getNewDepartId()); |
| | | equipment.setAssetStatus(AssetStatusEnum.NORMAL.name()); // 设å¤è°æ¨ |
| | | eamEquipmentService.updateById(equipment); |
| | | } |
| | | break; |
| | | case WAIT_COMPANY_LEADER_CHECK: |
| | | // å
¬å¸é¢å¯¼å®¡æ¹ç»æ |
| | | entity.setCompanyLeader(user.getUsername()); |
| | | entity.setCompanyLeaderApprovalTime(new Date()); |
| | | entity.setCompanyLeaderApprovalComment(request.getCompanyLeaderApprovalComment()); |
| | | entity.setCompanyLeaderApprovalDealType(request.getCompanyLeaderApprovalDealType()); |
| | | if (CommonConstant.APPROVED.equals(request.getCompanyLeaderApprovalDealType())) { |
| | | entity.setTransferStatus(EquipmentTransferStatusEnum.COMPLETE.name()); |
| | | equipment.setOrgId(entity.getNewDepartId()); |
| | | } else { |
| | | entity.setTransferStatus(EquipmentTransferStatusEnum.REJECT.name()); |
| | | } |
| | | equipment.setAssetStatus(AssetStatusEnum.NORMAL.name()); // 设å¤è°æ¨ |
| | | eamEquipmentService.updateById(equipment); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置æµç¨åé |
| | | * |
| | | * @param request |
| | | * @param entity |
| | | * @param user |
| | | * @param equipment |
| | | */ |
| | | private void setupProcessVariables(EamEquipmentTransferRequest request, EamEquipmentTransfer entity, LoginUser user, EamEquipment equipment) { |
| | | Map<String, Object> values = new HashMap<>(); |
| | | List<UserSelector> userSelectors; |
| | | List<String> userApprovalList; |
| | | EquipmentTransferStatusEnum status = EquipmentTransferStatusEnum.getInstance(entity.getTransferStatus()); |
| | | switch (status) { |
| | | case WAIT_USE_LEADER_CHECK: |
| | | // 使ç¨åä½é¢å¯¼å®¡æ¹ç»æ |
| | | values.put("dataId", entity.getId()); |
| | | values.put("organization", request.getUseLeaderApprovalComment()); |
| | | values.put("comment", request.getUseLeaderApprovalComment()); |
| | | if (CommonConstant.APPROVED.equals(request.getUseLeaderApprovalDealType())) { |
| | | // éè¿ |
| | | values.put("approvalDealType", request.getUseLeaderApprovalDealType()); |
| | | // è·åä¸ä¸æ¥å®¡æ¹äºº |
| | | userSelectors = sysUserService.selectOperatorList(entity.getNewDepartId(), BusinessCodeConst.PCR0008); |
| | | if (CollectionUtil.isEmpty(userSelectors)) { |
| | | throw new JeecgBootException("æªåé
è°å
¥åä½é¢å¯¼ï¼æ æ³è¿å
¥ä¸çº§å®¡æ¹ï¼"); |
| | | } |
| | | userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); |
| | | values.put("NextAssignee", userApprovalList); |
| | | } else { |
| | | // 驳å |
| | | values.put("approvalDealType", request.getUseLeaderApprovalDealType()); |
| | | } |
| | | request.setComment("使ç¨åä½é¢å¯¼å®¡æ¹ç»æ"); |
| | | break; |
| | | case WAIT_TRANSFER_LEADER_CHECK: |
| | | // è°å
¥åä½é¢å¯¼å®¡æ¹ç»æ |
| | | values.put("dataId", entity.getId()); |
| | | values.put("organization", request.getTransferLeaderApprovalComment()); |
| | | values.put("comment", request.getTransferLeaderApprovalComment()); |
| | | if (CommonConstant.APPROVED.equals(request.getTransferLeaderApprovalDealType())) { |
| | | // éè¿ |
| | | values.put("approvalDealType", request.getTransferLeaderApprovalDealType()); |
| | | // è·åä¸ä¸æ¥å®¡æ¹äºº |
| | | userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getOrgId(), BusinessCodeConst.PCR0006); |
| | | if (CollectionUtil.isEmpty(userSelectors)) { |
| | | throw new JeecgBootException("è®¾å¤æªåé
ç»æºå¨åï¼æ æ³è¿å
¥ä¸çº§å®¡æ¹ï¼"); |
| | | } |
| | | userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); |
| | | values.put("NextAssignee", userApprovalList); |
| | | } else { |
| | | // 驳å |
| | | values.put("approvalDealType", request.getTransferLeaderApprovalDealType()); |
| | | } |
| | | request.setComment("è°å
¥åä½é¢å¯¼å®¡æ¹ç»æ"); |
| | | break; |
| | | case WAIT_EXTERNAL_CONFIRM: |
| | | // æºå¨åç¡®è®¤ç»æ |
| | | values.put("dataId", entity.getId()); |
| | | values.put("organization", "æºå¨åç¡®è®¤ç»æ"); |
| | | values.put("comment", "æºå¨åç¡®è®¤ç»æ"); |
| | | if (CommonConstant.YN_1.equals(request.getCompanyLeaderCheck())) { |
| | | // éè¦ |
| | | values.put("confirmation", request.getCompanyLeaderCheck()); |
| | | // æµç¨è½¬å°å
¬å¸é¢å¯¼å®¡æ¹ |
| | | // è·åä¸ä¸æ¥å®¡æ¹äºº |
| | | userSelectors = sysUserService.selectOperatorList(BusinessCodeConst.PCR0009); |
| | | if (CollectionUtil.isEmpty(userSelectors)) { |
| | | throw new JeecgBootException("è®¾å¤æªåé
ç»å
¬å¸é¢å¯¼ï¼æ æ³è¿å
¥ä¸çº§å®¡æ¹ï¼"); |
| | | } |
| | | userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); |
| | | values.put("NextAssignee", userApprovalList); |
| | | } else { |
| | | values.put("confirmation", request.getCompanyLeaderCheck()); |
| | | } |
| | | request.setComment("æºå¨åç¡®è®¤ç»æ"); |
| | | break; |
| | | case WAIT_COMPANY_LEADER_CHECK: |
| | | // å
¬å¸é¢å¯¼å®¡æ¹ç»æ |
| | | values.put("dataId", entity.getId()); |
| | | values.put("organization", request.getCompanyLeaderApprovalComment()); |
| | | values.put("comment", request.getCompanyLeaderApprovalComment()); |
| | | request.setComment("å
¬å¸é¢å¯¼å®¡æ¹ç»æ"); |
| | | break; |
| | | } |
| | | request.setValues(values); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public List<String> flowCandidateUsernamesOfTask(String taskNameId, Map<String, Object> values) { |
| | | return null; |
| | | //ä¸å¡æ¯å¦å¹²é¢æµç¨ï¼ä¸å¡å¹²é¢ï¼æµç¨å¹²é¢ï¼æå®äººåè¿è¡å¤ç |
| | | //è·åä¸ä¸æ¥å¤ç人 |
| | | Object object = values.get("NextAssignee"); |
| | | return (List<String>) object; |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.flowable.engine.TaskService; |
| | | import org.flowable.task.api.Task; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.exception.JeecgBootException; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.eam.constant.AssetStatusEnum; |
| | | import org.jeecg.modules.eam.constant.BusinessCodeConst; |
| | | import org.jeecg.modules.eam.constant.EquipmentLeanOutStatusEnum; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentLeanOut; |
| | | import org.jeecg.modules.eam.entity.EamSparePartRequisition; |
| | | import org.jeecg.modules.eam.entity.EamSparePartRequisitionDetail; |
| | | import org.jeecg.modules.eam.mapper.EamSparePartRequisitionMapper; |
| | |
| | | FROM |
| | | mdc_equipment me |
| | | LEFT JOIN mdc_production_equipment mpe ON me.id = mpe.equipment_id |
| | | WHERE |
| | | mpe.production_id IN |
| | | <foreach collection="allProductionIds" index="index" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | WHERE 1=1 |
| | | <if test="allProductionIds != null and allProductionIds.size() > 0"> |
| | | and mpe.production_id IN |
| | | <foreach collection="allProductionIds" index="index" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | <!--æ ¹æ®äº§çº¿idæ¥è¯¢è®¾å¤idéå--> |
| | |
| | | List<String> getEquipmentIdsProduction(String userId, String key); |
| | | |
| | | /** |
| | | * æ¥è¯¢äº§çº¿ä¸çææè®¾å¤(é¦é¡µé¨æ ¹æ®ç¨æ·è¿è¡æ°æ®çé) |
| | | */ |
| | | List<String> getEquipmentIdsProduction(String key); |
| | | |
| | | /** |
| | | * æ ¹æ®è®¾å¤idæ¥è¯¢è®¾å¤åç§° |
| | | * |
| | | * @param equipmentId |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.dto.message.MessageDTO; |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢äº§çº¿ä¸çææè®¾å¤ |
| | | */ |
| | | @Override |
| | | public List<String> getEquipmentIdsProduction(String key) { |
| | | List<String> partProduction = Lists.newArrayList(); |
| | | if (StringUtils.isNotEmpty(key)) { |
| | | //keyä¸ä¸ºç©ºï¼æ¥è¯¢ææä¸çº§äº§çº¿id |
| | | partProduction = this.findAllProductions(key); |
| | | partProduction.add(key); |
| | | } |
| | | List<String> equipmentIds = this.baseMapper.queryIdsByProductions(partProduction); |
| | | return equipmentIds; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®è®¾å¤idæ¥è¯¢è®¾å¤åç§° |
| | | */ |
| | | @Override |
| | |
| | | @Resource |
| | | private IMdcHomeService mdcHomeService; |
| | | |
| | | @ApiOperation(value = "MDCé¦é¡µæ¥å£-æ¥è¯¢ææè½¦é´", notes = "MDCé¦é¡µæ¥å£-æ¥è¯¢ææè½¦é´") |
| | | @GetMapping("/getAllWorkShop") |
| | | public Result<List<MdcProduction>> getAllWorkShop() { |
| | | return Result.OK(mdcHomeService.getAllWorkShop()); |
| | | } |
| | | |
| | | @ApiOperation(value = "MDCé¦é¡µæ¥å£-设å¤è¿è¡ç¶æç»è®¡", notes = "MDCé¦é¡µæ¥å£-设å¤è¿è¡ç¶æç»è®¡") |
| | | @GetMapping("/equipmentStatusStatistics") |
| | | public Result<?> equipmentStatusStatistics(String productionCode) { |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | Integer userType = user.getUserType(); |
| | | String userId = user.getId(); |
| | | String key = ""; |
| | | if (StringUtils.isNotBlank(productionCode)) { |
| | | //ååº/工段 |
| | | MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getProductionCode, productionCode).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString())); |
| | | key = mdcProduction.getId(); |
| | | } else { |
| | | //夿æ¯å
¬å¸çº§è¿æ¯ååº |
| | | MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, "")); |
| | | if (userType.equals(MdcConstant.USER_TYPE_4)) { |
| | | //å
¬å¸ |
| | | key = mdcProduction.getId(); |
| | | } else if (userType.equals(MdcConstant.USER_TYPE_3)) { |
| | | //ååº |
| | | key = mdcProductionService.findFirstProduction(userId, mdcProduction.getId()); |
| | | } else if (userType.equals(MdcConstant.USER_TYPE_2)) { |
| | | //工段 æ¥è¯¢ç¨æ·æ¥æç工段æé |
| | | key = mdcProductionService.findThreeProductionId(userId); |
| | | } |
| | | } |
| | | List<MdcCommonVo> resultMap = mdcHomeService.getEquipmentStatusStatistics(userId, key); |
| | | public Result<?> equipmentStatusStatistics(String productionId) { |
| | | List<MdcCommonVo> resultMap = mdcHomeService.getEquipmentStatusStatistics(productionId); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("list", resultMap); |
| | | map.put("productionId", key); |
| | | return Result.OK(map); |
| | | } |
| | | |
| | | @ApiOperation(value = "MDCé¦é¡µæ¥å£-设å¤å©ç¨çç»è®¡(æ¨æ¥)", notes = "MDCé¦é¡µæ¥å£-设å¤è¿è¡ç¶æç»è®¡(æ¨æ¥)") |
| | | @GetMapping("/equipmentUtilizationStatistics") |
| | | public Result<?> equipmentUtilizationStatistics(String productionCode) { |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | Integer userType = user.getUserType(); |
| | | String userId = user.getId(); |
| | | String key = ""; |
| | | if (StringUtils.isNotBlank(productionCode)) { |
| | | //ååº |
| | | MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getProductionCode, productionCode).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString())); |
| | | key = mdcProduction.getId(); |
| | | } else { |
| | | //夿æ¯å
¬å¸çº§è¿æ¯ååº |
| | | MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, "")); |
| | | if (userType.equals(MdcConstant.USER_TYPE_4)) { |
| | | //å
¬å¸ |
| | | key = mdcProduction.getId(); |
| | | } else if (userType.equals(MdcConstant.USER_TYPE_3)) { |
| | | //ååº |
| | | key = mdcProductionService.findFirstProduction(userId, mdcProduction.getId()); |
| | | } |
| | | } |
| | | List<MdcCommonVo> result = mdcHomeService.getEquipmentUtilizationStatistics(userId, key); |
| | | public Result<?> equipmentUtilizationStatistics(String productionId) { |
| | | List<MdcCommonVo> result = mdcHomeService.getEquipmentUtilizationStatistics(productionId); |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @ApiOperation(value = "MDCé¦é¡µæ¥å£-设å¤OEEç»è®¡(䏿)", notes = "MDCé¦é¡µæ¥å£-设å¤OEEç»è®¡(䏿)") |
| | | @GetMapping("/equipmentOEEStatistics") |
| | | public Result<?> equipmentOEEStatistics(String productionCode) { |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | Integer userType = user.getUserType(); |
| | | String userId = user.getId(); |
| | | String key = ""; |
| | | if (StringUtils.isNotBlank(productionCode)) { |
| | | //ååº |
| | | MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getProductionCode, productionCode).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString())); |
| | | key = mdcProduction.getId(); |
| | | } else { |
| | | //夿æ¯å
¬å¸çº§è¿æ¯ååº |
| | | MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, "")); |
| | | if (userType.equals(MdcConstant.USER_TYPE_4)) { |
| | | //å
¬å¸ |
| | | key = mdcProduction.getId(); |
| | | } else if (userType.equals(MdcConstant.USER_TYPE_3)) { |
| | | //ååº |
| | | key = mdcProductionService.findFirstProduction(userId, mdcProduction.getId()); |
| | | } |
| | | } |
| | | List<MdcCommonVo> result = mdcHomeService.getEquipmentOeeStatistics(userId, key); |
| | | public Result<?> equipmentOEEStatistics(String productionId) { |
| | | List<MdcCommonVo> result = mdcHomeService.getEquipmentOeeStatistics(productionId); |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @ApiOperation(value = "MDCé¦é¡µæ¥å£-设å¤OEEåå©ç¨çç»è®¡æ±ç¶å¾", notes = "MDCé¦é¡µæ¥å£-设å¤OEEåå©ç¨çç»è®¡æ±ç¶å¾") |
| | | @GetMapping("/equipmentMonthStatistics") |
| | | public Result<?> equipmentMonthStatistics(String productionCode) { |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | Integer userType = user.getUserType(); |
| | | String userId = user.getId(); |
| | | String key = ""; |
| | | if (StringUtils.isNotBlank(productionCode)) { |
| | | //ååº |
| | | MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getProductionCode, productionCode).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString())); |
| | | key = mdcProduction.getId(); |
| | | } else { |
| | | //夿æ¯å
¬å¸çº§è¿æ¯ååº |
| | | MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, "")); |
| | | if (userType.equals(MdcConstant.USER_TYPE_4)) { |
| | | //å
¬å¸ |
| | | key = mdcProduction.getId(); |
| | | } else if (userType.equals(MdcConstant.USER_TYPE_3)) { |
| | | //ååº |
| | | key = mdcProductionService.findFirstProduction(userId, mdcProduction.getId()); |
| | | } |
| | | } |
| | | Map<String, Object> result = mdcHomeService.getEquipmentMonthStatistics(userId, key); |
| | | public Result<?> equipmentMonthStatistics(String productionId) { |
| | | MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, "")); |
| | | |
| | | String key = mdcProduction.getId(); |
| | | Map<String, Object> result = mdcHomeService.getEquipmentMonthStatistics(productionId); |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | @ApiOperation(value = "MDCé¦é¡µæ¥å£-工段级åä¸å¤©å©ç¨çæçº¿å¾", notes = "MDCé¦é¡µæ¥å£-工段级åä¸å¤©å©ç¨çæçº¿å¾") |
| | | @ApiOperation(value = "MDCé¦é¡µæ¥å£-工段级å15天å©ç¨çæçº¿å¾", notes = "MDCé¦é¡µæ¥å£-工段级å15天å©ç¨çæçº¿å¾") |
| | | @GetMapping("/equipmentDayUtilizationStatistics") |
| | | public Result<?> equipmentDayUtilizationStatistics(String productionCode) { |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | String key = ""; |
| | | if (StringUtils.isNotBlank(productionCode)) { |
| | | //ååº |
| | | MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getProductionCode, productionCode).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString())); |
| | | key = mdcProduction.getId(); |
| | | } else { |
| | | //工段 æ¥è¯¢ç¨æ·æ¥æç工段æé |
| | | key = mdcProductionService.findThreeProductionId(userId); |
| | | } |
| | | Map<String, Object> result = mdcHomeService.getEquipmentDayUtilizationStatistics(userId, key); |
| | | public Result<?> equipmentDayUtilizationStatistics(String productionId) { |
| | | Map<String, Object> result = mdcHomeService.getEquipmentDayUtilizationStatistics(productionId); |
| | | return Result.OK(result); |
| | | } |
| | | |
| | |
| | | return Result.OK(result); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "MDCé¦é¡µæ¥å£-é®é¢å表", notes = "MDCé¦é¡µæ¥å£-é®é¢å表") |
| | | @GetMapping("/feedbackList") |
| | | public Result<?> feedbackList(String productionCode) { |
| | |
| | | |
| | | <select id="getProductionByPid" resultType="org.jeecg.modules.system.entity.MdcProduction"> |
| | | SELECT |
| | | t1.* |
| | | t1.* |
| | | FROM |
| | | mdc_production t1 |
| | | LEFT JOIN mdc_user_production t2 ON t1.id = t2.pro_id |
| | | WHERE |
| | | t1.parent_id = #{ productionId } AND t2.user_id = #{ userId } |
| | | mdc_production t1 |
| | | -- LEFT JOIN mdc_user_production t2 ON t1.id = t2.pro_id |
| | | WHERE 1=1 |
| | | <if test="productionId != null and productionId != ''"> |
| | | AND t1.parent_id = #{ productionId } |
| | | </if> |
| | | <!-- <if test="userId != null and userId != ''">--> |
| | | <!-- AND t2.user_id = #{ userId }--> |
| | | <!-- </if>--> |
| | | </select> |
| | | |
| | | <select id="getProcessCount" resultType="java.math.BigDecimal"> |
| | |
| | | <select id="getEquipmentSevenUtilizationStatistics" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo"> |
| | | SELECT |
| | | equipment_id, |
| | | the_date, |
| | | SUM ( process_long ) processLong, |
| | | SUM ( open_long ) openLong |
| | | FROM |
| | |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | equipment_id |
| | | equipment_id, |
| | | the_date |
| | | </select> |
| | | |
| | | |
| | |
| | | import org.jeecg.modules.mdc.entity.MdcOverallEquipmentEfficiency; |
| | | import org.jeecg.modules.mdc.vo.MdcCommonVo; |
| | | import org.jeecg.modules.mdc.vo.MdcHomeEfficiencyVo; |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | /** |
| | | * 设å¤è¿è¡ç¶æç»è®¡ |
| | | */ |
| | | List<MdcCommonVo> getEquipmentStatusStatistics(String userId, String key); |
| | | List<MdcCommonVo> getEquipmentStatusStatistics(String productionId); |
| | | |
| | | /** |
| | | * 设å¤å©ç¨çç»è®¡ |
| | | */ |
| | | List<MdcCommonVo> getEquipmentUtilizationStatistics(String userId, String key); |
| | | List<MdcCommonVo> getEquipmentUtilizationStatistics(String productionId); |
| | | |
| | | /** |
| | | * 设å¤OEEç»è®¡ |
| | | */ |
| | | List<MdcCommonVo> getEquipmentOeeStatistics(String userId, String key); |
| | | List<MdcCommonVo> getEquipmentOeeStatistics(String productionId); |
| | | |
| | | /** |
| | | * 设å¤OEEåå©ç¨çç»è®¡æ±ç¶å¾ |
| | | */ |
| | | Map<String, Object> getEquipmentMonthStatistics(String userId, String key); |
| | | Map<String, Object> getEquipmentMonthStatistics(String productionId); |
| | | |
| | | /** |
| | | * 工段级åä¸å¤©å©ç¨çæçº¿å¾ |
| | | */ |
| | | Map<String, Object> getEquipmentDayUtilizationStatistics(String userId, String key); |
| | | Map<String, Object> getEquipmentDayUtilizationStatistics(String productionId); |
| | | |
| | | /** |
| | | * æ¥è¯¢è®¾å¤ä¸æOEE |
| | |
| | | MdcEquipmentDto getEquipmentDetails(String equipmentId); |
| | | |
| | | List<MdcFeedback> getFeedbackList(String key); |
| | | |
| | | List<MdcProduction> getAllWorkShop(); |
| | | } |
| | |
| | | package org.jeecg.modules.mdc.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jeecg.common.system.vo.DictModel; |
| | | import org.jeecg.modules.mdc.constant.MdcConstant; |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentDto; |
| | |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author Lius |
| | |
| | | * 设å¤è¿è¡ç¶æç»è®¡ |
| | | */ |
| | | @Override |
| | | public List<MdcCommonVo> getEquipmentStatusStatistics(String userId, String key) { |
| | | public List<MdcCommonVo> getEquipmentStatusStatistics(String productionId) { |
| | | List<MdcCommonVo> result = new ArrayList<>(); |
| | | MdcCommonVo mdcCommonVo1 = new MdcCommonVo(); |
| | | mdcCommonVo1.setName("å
³æº"); |
| | |
| | | mdcCommonVo4.setValue("0"); |
| | | result.add(mdcCommonVo4); |
| | | MdcEquipmentStatusVo mdcEquipmentStatusVo = new MdcEquipmentStatusVo(); |
| | | if (StringUtils.isBlank(key)) { |
| | | return result; |
| | | |
| | | //è·åææè®¾å¤ |
| | | List<Equipment> equipmentList = Lists.newArrayList(); |
| | | if (StringUtils.isNotBlank(productionId)) { |
| | | List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(productionId); |
| | | equipmentList = CollectionUtils.isNotEmpty(equipmentIdList) ? equipmentService.listByIds(equipmentIdList) : new ArrayList<>(); |
| | | }else { |
| | | equipmentList = equipmentService.list(); |
| | | } |
| | | List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(userId, key); |
| | | if (equipmentIdList == null || equipmentIdList.isEmpty()) { |
| | | return result; |
| | | } |
| | | // List<EquipmentLog> logList = equipmentLogService.getEquipmentStatusList(equipmentIdList); |
| | | List<Equipment> equipmentList = equipmentService.list(new LambdaQueryWrapper<Equipment>().in(Equipment::getEquipmentid, equipmentIdList)); |
| | | |
| | | if (equipmentList != null && !equipmentList.isEmpty()) { |
| | | for (Equipment equipment : equipmentList) { |
| | | if (equipment.getOporation() != null) { |
| | |
| | | * 设å¤å©ç¨çç»è®¡ |
| | | */ |
| | | @Override |
| | | public List<MdcCommonVo> getEquipmentUtilizationStatistics(String userId, String key) { |
| | | public List<MdcCommonVo> getEquipmentUtilizationStatistics(String productionId) { |
| | | List<MdcCommonVo> result = new ArrayList<>(); |
| | | //è·åå
¬å¸æååºäºçº§ä¿¡æ¯ |
| | | List<MdcProduction> mdcProductionList = mdcHomeMapper.getProductionByPid(userId, key); |
| | | List<MdcProduction> mdcProductionList = mdcHomeMapper.getProductionByPid(null, productionId); |
| | | |
| | | //妿ä¸ä¼ âproductionIdâåæ°ï¼åæ¥ææè½¦é´ï¼å¦åæ¥è¯¢è¯¥è½¦é´ä¸ç工段ç |
| | | if (StringUtils.isEmpty(productionId)) { |
| | | mdcProductionList = mdcProductionList.stream().filter(mdcProduction -> "2".equals(mdcProduction.getOrgType())).collect(Collectors.toList()); |
| | | } |
| | | if (mdcProductionList != null && !mdcProductionList.isEmpty()) { |
| | | for (MdcProduction mdcProduction : mdcProductionList) { |
| | | MdcCommonVo mdcCommonVo = new MdcCommonVo(); |
| | |
| | | mdcCommonVo.setProductionCode(mdcProduction.getProductionCode()); |
| | | mdcCommonVo.setProductionId(mdcProduction.getId()); |
| | | //è·åæ¤å±çº§ä¸è®¾å¤ |
| | | List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcProduction.getId()); |
| | | List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(mdcProduction.getId()); |
| | | if (equipmentIdList == null || equipmentIdList.isEmpty()) { |
| | | mdcCommonVo.setValue("0"); |
| | | } else { |
| | |
| | | * 设å¤OEEç»è®¡ |
| | | */ |
| | | @Override |
| | | public List<MdcCommonVo> getEquipmentOeeStatistics(String userId, String key) { |
| | | public List<MdcCommonVo> getEquipmentOeeStatistics(String productionId) { |
| | | List<MdcCommonVo> result = new ArrayList<>(); |
| | | //è·åå
¬å¸æååºäºçº§ä¿¡æ¯ |
| | | List<MdcProduction> mdcProductionList = mdcHomeMapper.getProductionByPid(userId, key); |
| | | List<MdcProduction> mdcProductionList = mdcHomeMapper.getProductionByPid(null, productionId); |
| | | //妿ä¸ä¼ âproductionIdâåæ°ï¼åæ¥ææè½¦é´ï¼å¦åæ¥è¯¢è¯¥è½¦é´ä¸ç工段ç |
| | | if (StringUtils.isEmpty(productionId)) { |
| | | mdcProductionList = mdcProductionList.stream().filter(mdcProduction -> "2".equals(mdcProduction.getOrgType())).collect(Collectors.toList()); |
| | | } |
| | | if (mdcProductionList != null && !mdcProductionList.isEmpty()) { |
| | | for (MdcProduction mdcProduction : mdcProductionList) { |
| | | MdcCommonVo mdcCommonVo = new MdcCommonVo(); |
| | |
| | | mdcCommonVo.setProductionCode(mdcProduction.getProductionCode()); |
| | | mdcCommonVo.setProductionId(mdcProduction.getId()); |
| | | //è·åæ¤å±çº§ä¸è®¾å¤ |
| | | List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcProduction.getId()); |
| | | List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(mdcProduction.getId()); |
| | | if (equipmentIdList == null || equipmentIdList.isEmpty()) { |
| | | mdcCommonVo.setValue("0"); |
| | | } else { |
| | |
| | | if (oee == null || oee.compareTo(BigDecimal.ZERO) == 0) { |
| | | mdcCommonVo.setValue("0"); |
| | | } else { |
| | | mdcCommonVo.setValue(oee.divide(new BigDecimal(equipmentIdList.size()), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).toString()); |
| | | mdcCommonVo.setValue(CollectionUtils.isNotEmpty(equipmentIdList) ? oee.divide(new BigDecimal(equipmentIdList.size()), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).toString() : "0"); |
| | | } |
| | | } |
| | | result.add(mdcCommonVo); |
| | |
| | | * 设å¤OEEåå©ç¨çç»è®¡æ±ç¶å¾ |
| | | */ |
| | | @Override |
| | | public Map<String, Object> getEquipmentMonthStatistics(String userId, String key) { |
| | | List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(userId, key); |
| | | public Map<String, Object> getEquipmentMonthStatistics(String productionId) { |
| | | List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(productionId); |
| | | Map<String, Object> result = new HashMap<>(); |
| | | Date end = DateUtils.toDate(LocalDate.now().plusMonths(-1).toString(), DateUtils.STR_DATE); |
| | | Date start = DateUtils.toDate(LocalDate.now().plusMonths(-12).toString(), DateUtils.STR_DATE); |
| | |
| | | if (oee == null || oee.compareTo(BigDecimal.ZERO) == 0) { |
| | | mdcCommonOeeVo.setValue("0"); |
| | | } else { |
| | | mdcCommonOeeVo.setValue(oee.divide(new BigDecimal(equipmentIdList.size()), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).toString()); |
| | | mdcCommonOeeVo.setValue(CollectionUtils.isNotEmpty(equipmentIdList) ? oee.divide(new BigDecimal(equipmentIdList.size()), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP).toString() : "0"); |
| | | } |
| | | } |
| | | utilizationList.add(mdcCommonUtilizationVo); |
| | |
| | | * 工段级åä¸å¤©å©ç¨çæçº¿å¾ |
| | | */ |
| | | @Override |
| | | public Map<String, Object> getEquipmentDayUtilizationStatistics(String userId, String key) { |
| | | public Map<String, Object> getEquipmentDayUtilizationStatistics(String productionId) { |
| | | Map<String, Object> result = new HashMap<>(); |
| | | List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(userId, key); |
| | | //è·ååä¸å¤©æ¥æéå |
| | | String start = DateUtils.format(DateUtils.toDate(LocalDate.now().plusDays(-7).toString(), DateUtils.STR_DATE), DateUtils.STRDATE); |
| | | String end = DateUtils.format(DateUtils.toDate(LocalDate.now().plusDays(-1).toString(), DateUtils.STR_DATE), DateUtils.STRDATE); |
| | | if (equipmentIdList != null && !equipmentIdList.isEmpty()) { |
| | | List<MdcEquipment> mdcEquipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().in(MdcEquipment::getEquipmentId, equipmentIdList)); |
| | | result.put("mdcEquipmentList", mdcEquipmentList); |
| | | List<MdcEquipmentStatisticalInfo> mdcEquipmentStatisticalInfoList = mdcHomeMapper.getEquipmentSevenUtilizationStatistics(equipmentIdList, start, end); |
| | | List<EquipmentDayUtilizationVo> dataList = new ArrayList<>(); |
| | | if (mdcEquipmentStatisticalInfoList != null && !mdcEquipmentStatisticalInfoList.isEmpty()) { |
| | | for (MdcEquipmentStatisticalInfo mdcEquipmentStatisticalInfo : mdcEquipmentStatisticalInfoList) { |
| | | EquipmentDayUtilizationVo equipmentDayUtilizationVo = new EquipmentDayUtilizationVo(); |
| | | equipmentDayUtilizationVo.setEquipmentId(mdcEquipmentStatisticalInfo.getEquipmentId()); |
| | | equipmentDayUtilizationVo.setUtilizationRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 4, RoundingMode.HALF_UP).divide(new BigDecimal(mdcEquipmentStatisticalInfoList.size()), 4, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP)); |
| | | if (BigDecimal.ZERO.compareTo(mdcEquipmentStatisticalInfo.getOpenLong()) == -1) { |
| | | equipmentDayUtilizationVo.setOpenRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(mdcEquipmentStatisticalInfo.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP)); |
| | | equipmentDayUtilizationVo.setStartRate(mdcEquipmentStatisticalInfo.getOpenLong().divide(new BigDecimal("864"), 4, RoundingMode.HALF_UP).divide(new BigDecimal(mdcEquipmentStatisticalInfoList.size()), 4, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP)); |
| | | } |
| | | dataList.add(equipmentDayUtilizationVo); |
| | | } |
| | | } |
| | | result.put("dataList", dataList); |
| | | } |
| | | /*List<String> dayBetween = DateUtils.getDatesStringList2(start, end); |
| | | |
| | | List<String> equipmentIdList = mdcEquipmentService.getEquipmentIdsProduction(productionId); |
| | | Date startDate = DateUtils.toDate(LocalDate.now().plusDays(-15).toString(), DateUtils.STR_DATE); |
| | | String start = DateUtils.format(startDate, DateUtils.STRDATE); |
| | | Date endDate = DateUtils.toDate(LocalDate.now().plusDays(-1).toString(), DateUtils.STR_DATE); |
| | | String end = DateUtils.format(endDate, DateUtils.STRDATE); |
| | | List<MdcEquipmentStatisticalInfo> mdcEquipmentStatisticalInfos = mdcHomeMapper.getEquipmentSevenUtilizationStatistics(equipmentIdList, start, end); |
| | | Map<String, MdcEquipmentStatisticalInfo> mdcEquipmentStatisticalInfoMap = mdcEquipmentStatisticalInfos.stream().collect(Collectors.toMap(MdcEquipmentStatisticalInfo::getTheDate, mdcEquipmentStatisticalInfo -> mdcEquipmentStatisticalInfo, (v1, v2) -> v1)); |
| | | List<String> dayBetween = DateUtils.getDatesStringList2(startDate, endDate); |
| | | |
| | | List<String> dateList = new ArrayList<>(); |
| | | List<EquipmentDayUtilizationVo> dataList = new ArrayList<>(); |
| | | |
| | | for (String date : dayBetween) { |
| | | EquipmentDayUtilizationVo equipmentDayUtilizationVo = new EquipmentDayUtilizationVo(); |
| | | String item = date.substring(4); |
| | |
| | | item = item.substring(1); |
| | | String sub = item.substring(1); |
| | | if (sub.startsWith("0")) { |
| | | item = item.substring(0, 1) + "æ" + sub.substring(1) + "æ¥"; |
| | | item = item.substring(0, 1) + "-" + sub.substring(1); |
| | | } else { |
| | | item = item.substring(0, 1) + "æ" + item.substring(1) + "æ¥"; |
| | | item = item.substring(0, 1) + "-" + item.substring(1); |
| | | } |
| | | } else { |
| | | String sub = item.substring(2); |
| | | if (sub.startsWith("0")) { |
| | | item = item.substring(0, 2) + "æ" + sub.substring(2) + "æ¥"; |
| | | item = item.substring(0, 2) + "-" + sub.substring(2); |
| | | } else { |
| | | item = item.substring(0, 2) + "æ" + item.substring(2) + "æ¥"; |
| | | item = item.substring(0, 2) + "-" + item.substring(2); |
| | | } |
| | | } |
| | | dateList.add(item); |
| | | equipmentDayUtilizationVo.setDate(item); |
| | | if (equipmentIdList != null && !equipmentIdList.isEmpty()) { |
| | | //è·ååä¸å¤©å©ç¨çæ°æ® |
| | | List<MdcEquipmentStatisticalInfo> mdcEquipmentStatisticalInfos = mdcHomeMapper.getEquipmentDayUtilizationStatistics(equipmentIdList, dayBetween); |
| | | if (mdcEquipmentStatisticalInfos != null && !mdcEquipmentStatisticalInfos.isEmpty()) { |
| | | for (MdcEquipmentStatisticalInfo mdcEquipmentStatisticalInfo : mdcEquipmentStatisticalInfos) { |
| | | if (mdcEquipmentStatisticalInfo.getTheDate().equals(date)) { |
| | | equipmentDayUtilizationVo.setUtilizationRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 4, RoundingMode.HALF_UP).divide(new BigDecimal(equipmentIdList.size()), 4, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP)); |
| | | if (BigDecimal.ZERO.compareTo(mdcEquipmentStatisticalInfo.getOpenLong()) == -1) { |
| | | equipmentDayUtilizationVo.setOpenRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(mdcEquipmentStatisticalInfo.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP)); |
| | | equipmentDayUtilizationVo.setStartRate(mdcEquipmentStatisticalInfo.getOpenLong().divide(new BigDecimal("864"), 4, RoundingMode.HALF_UP).divide(new BigDecimal(equipmentIdList.size()), 4, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP)); |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | dataList.add(equipmentDayUtilizationVo); |
| | | |
| | | if (null != mdcEquipmentStatisticalInfoMap && mdcEquipmentStatisticalInfoMap.containsKey(date)) { |
| | | //è·åå½åæ¥æä¸çå©ç¨çæ°æ® |
| | | MdcEquipmentStatisticalInfo mdcEquipmentStatisticalInfo = mdcEquipmentStatisticalInfoMap.get(date); |
| | | equipmentDayUtilizationVo.setUtilizationRate(CollectionUtils.isNotEmpty(equipmentIdList) ? mdcEquipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 4, RoundingMode.HALF_UP).divide(new BigDecimal(equipmentIdList.size()), 4, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | if (BigDecimal.ZERO.compareTo(mdcEquipmentStatisticalInfo.getOpenLong()) == -1) { |
| | | equipmentDayUtilizationVo.setOpenRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(mdcEquipmentStatisticalInfo.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP)); |
| | | equipmentDayUtilizationVo.setStartRate(CollectionUtils.isNotEmpty(equipmentIdList) ? mdcEquipmentStatisticalInfo.getOpenLong().divide(new BigDecimal("864"), 4, RoundingMode.HALF_UP).divide(new BigDecimal(equipmentIdList.size()), 4, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO); |
| | | } |
| | | } else { |
| | | dataList.add(equipmentDayUtilizationVo); |
| | | } |
| | | dataList.add(equipmentDayUtilizationVo); |
| | | } |
| | | result.put("dateList", dateList); |
| | | result.put("dataList", dataList);*/ |
| | | result.put("dataList", dataList); |
| | | return result; |
| | | } |
| | | |
| | |
| | | public List<MdcFeedback> getFeedbackList(String key) { |
| | | return mdcFeedbackService.getFeedbackList(key); |
| | | } |
| | | |
| | | @Override |
| | | public List<MdcProduction> getAllWorkShop() { |
| | | List<MdcProduction> list = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getOrgType, "2")); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return null; |
| | | } |
| | | return list; |
| | | } |
| | | } |
| | |
| | | */ |
| | | private String equipmentId; |
| | | /** |
| | | * 设å¤ç¼å· |
| | | */ |
| | | private String date; |
| | | /** |
| | | * å©ç¨ç |
| | | */ |
| | | private BigDecimal utilizationRate = BigDecimal.ZERO; |
| | |
| | | |
| | | /** |
| | | * éæ©ç¨æ· |
| | | * @param productionId éæ©ç车é´ID |
| | | * @param positionCode å²ä½ç¼å· |
| | | * @return |
| | | */ |
| | | List<UserSelector> selectOperatorList( String positionCode); |
| | | List<UserSelector> selectOperatorList(String productionId, String positionCode); |
| | | |
| | | /** |
| | | * éæ©ç¨æ· |
| | | * @param positionCode å²ä½ç¼å· |
| | | * @return |
| | | */ |
| | | List<UserSelector> selectOperatorList(String positionCode); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·åæ¹éè·åçå®å§åæ å° |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<UserSelector> selectOperatorList(String productionId, String positionCode) { |
| | | LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(SysUser::getPost, positionCode); |
| | | if(StringUtils.isNotBlank(productionId)) { |
| | | queryWrapper.exists("select 1 from mdc_user_production t where t.user_id=sys_user.id and t.pro_id={0}", productionId); |
| | | } |
| | | queryWrapper.eq(SysUser::getDelFlag, CommonConstant.DEL_FLAG_0); |
| | | queryWrapper.eq(SysUser::getStatus, CommonConstant.DEL_FLAG_1); |
| | | queryWrapper.orderByDesc(SysUser::getId); |
| | | List<SysUser> sysUsers = userMapper.selectList(queryWrapper); |
| | | List<UserSelector> collect = sysUsers.stream().map(user -> new UserSelector(user.getId(), user.getUsername(), user.getRealname())).collect(Collectors.toList()); |
| | | return collect; |
| | | } |
| | | |
| | | @Override |
| | | public List<UserSelector> selectOperatorList(String positionCode) { |
| | | LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(SysUser::getPost, positionCode); |