| | |
| | | .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() |
| | | .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() |
| | | .antMatchers("/bs/technologyRouteChild/ttest").permitAll() |
| | | .antMatchers("/bs/orderScheduling/engine-report").permitAll() |
| | | .antMatchers("/websocket/**").anonymous() |
| | | // é¤ä¸é¢å¤çææ请æ±å
¨é¨éè¦é´æè®¤è¯ |
| | | .anyRequest().authenticated() |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.jcdm.main.bs.orderScheduling.Query; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class SAPQuery { |
| | | |
| | | private String IV_ZFDJM; |
| | | } |
| | |
| | | package com.jcdm.main.bs.orderScheduling.controller; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.ExcelWriter; |
| | |
| | | import com.jcdm.common.exception.ServiceException; |
| | | import com.jcdm.common.utils.StringUtils; |
| | | import com.jcdm.common.utils.poi.ExcelUtil; |
| | | import com.jcdm.main.bs.orderScheduling.Query.SAPQuery; |
| | | import com.jcdm.main.bs.orderScheduling.common.Constants; |
| | | import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling; |
| | | import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService; |
| | | import com.jcdm.main.bs.orderScheduling.vo.FollowReportVO; |
| | | import com.jcdm.main.bs.orderScheduling.vo.LineChartVO; |
| | | import com.jcdm.main.bs.orderScheduling.vo.ReportVO; |
| | | import com.jcdm.main.bs.orderScheduling.vo.SumDataVO; |
| | | import com.jcdm.main.da.paramCollection.domain.DaParamCollection; |
| | | import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper; |
| | |
| | | return R.fail("æªæ¥æ¾å°è¯¥åå¨æºå·å¯¹åºçç®±ä½"); |
| | | } |
| | | } |
| | | |
| | | |
| | | @PostMapping("/engine-report") |
| | | public R getReportDetail(SAPQuery sapQuery){ |
| | | ReportVO reportVO = new ReportVO(); |
| | | if (StrUtil.isBlank(sapQuery.getIV_ZFDJM())){ |
| | | reportVO.setEV_STATUS("E"); |
| | | reportVO.setEV_MESSAGE("åå¨æºå·ä¸è½ä¸ºç©º"); |
| | | } |
| | | BsOrderScheduling query = new BsOrderScheduling(); |
| | | query.setEngineNo(sapQuery.getIV_ZFDJM()); |
| | | List<BsOrderScheduling> bsOrderSchedulingList = bsOrderSchedulingService.selectBsOrderSchedulingList(query); |
| | | if (CollUtil.isNotEmpty(bsOrderSchedulingList)){ |
| | | BsOrderScheduling bsOrderScheduling = bsOrderSchedulingList.get(0); |
| | | if (StrUtil.isBlank(bsOrderScheduling.getReport20())){ |
| | | reportVO.setEV_STATUS("0"); |
| | | reportVO.setEV_MESSAGE("æªæ¥å·¥"); |
| | | } else { |
| | | if ("1".equals(bsOrderScheduling.getReport20())){ |
| | | reportVO.setEV_STATUS("1"); |
| | | reportVO.setEV_MESSAGE("å·²æ¥å·¥"); |
| | | } else if ("3".equals(bsOrderScheduling.getReport20())){ |
| | | reportVO.setEV_STATUS("E"); |
| | | reportVO.setEV_MESSAGE(bsOrderScheduling.getRemarks()); |
| | | } |
| | | } |
| | | } else { |
| | | reportVO.setEV_STATUS("E"); |
| | | reportVO.setEV_MESSAGE("æªæ¥è¯¢å°æ¤åå¨æºä¿¡æ¯"); |
| | | } |
| | | return R.ok(reportVO); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.jcdm.main.bs.orderScheduling.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ReportVO { |
| | | |
| | | private String EV_STATUS; |
| | | |
| | | private String EV_MESSAGE; |
| | | |
| | | } |
| | |
| | | * @return ééåæ°é
ç½®éå |
| | | */ |
| | | public List<DaCollectionParamConf> selectDaCollectionParamConfList(DaCollectionParamConf daCollectionParamConf); |
| | | public List<DaCollectionParamConf> getSelectOption(DaCollectionParamConf daCollectionParamConf); |
| | | |
| | | /** |
| | | * æ°å¢ééåæ°é
ç½® |
| | |
| | | * @return ééåæ°é
ç½®éå |
| | | */ |
| | | public List<DaCollectionParamConf> selectDaCollectionParamConfList(DaCollectionParamConf daCollectionParamConf); |
| | | public List<DaCollectionParamConf> getSelectOption(DaCollectionParamConf daCollectionParamConf); |
| | | |
| | | /** |
| | | * æ°å¢ééåæ°é
ç½® |
| | |
| | | return daCollectionParamConfMapper.selectDaCollectionParamConfList(daCollectionParamConf); |
| | | } |
| | | |
| | | @Override |
| | | public List<DaCollectionParamConf> getSelectOption(DaCollectionParamConf daCollectionParamConf) { |
| | | return daCollectionParamConfMapper.getSelectOption(daCollectionParamConf); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ééåæ°é
ç½® |
| | | * |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.jcdm.main.da.collectionParamConf.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ChartVO { |
| | | |
| | | private List<Options> locationList; |
| | | |
| | | private List<Options> paramCodeList; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.jcdm.main.da.collectionParamConf.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class Options { |
| | | |
| | | private String label; |
| | | |
| | | private String value; |
| | | } |
| | |
| | | package com.jcdm.main.da.paramCollection.controller; |
| | | |
| | | import java.time.LocalTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.jcdm.common.core.domain.R; |
| | | import com.jcdm.common.utils.DateUtils; |
| | | import com.jcdm.main.da.collectionParamConf.domain.DaCollectionParamConf; |
| | | import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService; |
| | | import com.jcdm.main.da.collectionParamConf.vo.ChartVO; |
| | | import com.jcdm.main.da.collectionParamConf.vo.Options; |
| | | import com.jcdm.main.da.paramCollection.domain.DaParamCollection; |
| | | import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | @Autowired |
| | | private IDaParamCollectionService daParamCollectionService; |
| | | |
| | | @Resource |
| | | private IDaCollectionParamConfService daCollectionParamConfService; |
| | | |
| | | /** |
| | | * æ¥è¯¢è®¾å¤äº§åè¿ç¨åæ°ééå表 |
| | | */ |
| | |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/queryChart") |
| | | public R queryChart(DaParamCollection daParamCollection) |
| | | { |
| | | if(daParamCollection.getDateConditions()!=null){ |
| | | String[] conditions = daParamCollection.getDateConditions(); |
| | | daParamCollection.setStartTime(conditions[0]); |
| | | daParamCollection.setEndTime(conditions[1]); |
| | | } else { |
| | | return R.fail("请éæ©æ¥æèå´"); |
| | | } |
| | | if (StrUtil.isBlank(daParamCollection.getLocationCode())){ |
| | | return R.fail("请è¾å
¥å·¥ä½ç¼å·"); |
| | | } |
| | | if (StrUtil.isBlank(daParamCollection.getParamName())){ |
| | | return R.fail("请éæ©æ°æ®ç±»å"); |
| | | } |
| | | if (StrUtil.isBlank(daParamCollection.getParamCode())){ |
| | | return R.fail("请éæ©èºæ "); |
| | | } |
| | | List<DaParamCollection> list = daParamCollectionService.queryDaParamCollectionListForSearch(daParamCollection); |
| | | String[] array = list.stream().map(DaParamCollection::getParamValue).toArray(String[]::new); |
| | | return R.ok(array); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getSelectOption") |
| | | public R getSelectOption(DaParamCollection daParamCollection){ |
| | | ChartVO chartVO = new ChartVO(); |
| | | List<Options> locationList = new ArrayList<>(); |
| | | List<Options> paramCodeList = new ArrayList<>(); |
| | | DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf(); |
| | | if (StrUtil.isBlank(daParamCollection.getLocationCode())){ |
| | | List<DaCollectionParamConf> selectOption = daCollectionParamConfService.getSelectOption(daCollectionParamConf); |
| | | List<String> collect = selectOption.stream().map(DaCollectionParamConf::getProcessesCode).distinct().collect(Collectors.toList()); |
| | | if (CollUtil.isNotEmpty(collect)){ |
| | | for (String s : collect) { |
| | | Options options = new Options(); |
| | | options.setLabel(s); |
| | | options.setValue(s); |
| | | locationList.add(options); |
| | | } |
| | | } |
| | | } else { |
| | | List<DaCollectionParamConf> selectOption2 = daCollectionParamConfService.getSelectOption(daCollectionParamConf); |
| | | List<String> collect = selectOption2.stream().map(DaCollectionParamConf::getProcessesCode).distinct().collect(Collectors.toList()); |
| | | if (CollUtil.isNotEmpty(collect)){ |
| | | for (String s : collect) { |
| | | Options options = new Options(); |
| | | options.setLabel(s); |
| | | options.setValue(s); |
| | | locationList.add(options); |
| | | } |
| | | } |
| | | |
| | | daCollectionParamConf.setProcessesCode(daParamCollection.getLocationCode()); |
| | | if (StrUtil.isNotBlank(daParamCollection.getParamName())){ |
| | | daCollectionParamConf.setCollectParameterName(daParamCollection.getParamName()); |
| | | List<DaCollectionParamConf> selectOption = daCollectionParamConfService.getSelectOption(daCollectionParamConf); |
| | | if (CollUtil.isNotEmpty(selectOption)){ |
| | | for (DaCollectionParamConf collectionParamConf : selectOption) { |
| | | Options options = new Options(); |
| | | options.setLabel(collectionParamConf.getParameterSetName()); |
| | | options.setValue(collectionParamConf.getParameterSetCode()); |
| | | paramCodeList.add(options); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | chartVO.setLocationList(locationList); |
| | | chartVO.setParamCodeList(paramCodeList); |
| | | return R.ok(chartVO); |
| | | } |
| | | |
| | | /** |
| | | * 导åºè®¾å¤äº§åè¿ç¨åæ°ééå表 |
| | | */ |
| | |
| | | <sql id="selectDaCollectionParamConfVo"> |
| | | select id, processes_code, parameter_set_code, parameter_set_name, collect_parameter_id, collect_parameter_name, contrast_parameter_flag, collect_parameter_type, collect_parameter_unit, Descriptives, param_upper, param_lower, param_Central, product_code, gather_address, gather_sequence, remarks, create_user, create_time, update_user, update_time, spare_field_1, spare_field_2, spare_field_3, spare_field_4 from da_collection_param_conf |
| | | </sql> |
| | | <sql id="selectOptionVo"> |
| | | select id, processes_code, parameter_set_code, parameter_set_name, collect_parameter_id, collect_parameter_name, remarks from da_collection_param_conf |
| | | </sql> |
| | | |
| | | <select id="selectDaCollectionParamConfList" parameterType="DaCollectionParamConf" resultMap="DaCollectionParamConfResult"> |
| | | <include refid="selectDaCollectionParamConfVo"/> |
| | |
| | | <include refid="selectDaCollectionParamConfVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <select id="getSelectOption" |
| | | resultMap="DaCollectionParamConfResult"> |
| | | <include refid="selectOptionVo"/> |
| | | <where> |
| | | remarks = '1' and collect_parameter_name in ('è§åº¦','æç©') |
| | | <if test="processesCode != null and processesCode != ''"> and processes_code like concat('%', #{processesCode}, '%')</if> |
| | | <if test="parameterSetCode != null and parameterSetCode != ''"> and parameter_set_code like concat('%', #{parameterSetCode}, '%')</if> |
| | | <if test="collectParameterName != null and collectParameterName != ''"> and collect_parameter_name like concat('%', #{collectParameterName}, '%')</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <insert id="insertDaCollectionParamConf" parameterType="DaCollectionParamConf"> |
| | | insert into da_collection_param_conf |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | if (CollUtil.isNotEmpty(bsOrderSchedulings)){ |
| | | BsOrderScheduling orderScheduling = bsOrderSchedulings.get(0); |
| | | try { |
| | | String xmlResult = ReceivingServices.getInterfaceInformationXml(url, getProductionPlanInformationXml(orderScheduling.getOrderNo(), "0010")); |
| | | String xmlResult = ReceivingServices.getInterfaceInformationXml(url, getProductionPlanInformationXml(orderScheduling.getOrderNo(),orderScheduling.getEngineNo(), "0010")); |
| | | ev_meassage=ReceivingServices.xmlToJSON1(xmlResult); |
| | | status = ReceivingServices.xmlToJSON3(xmlResult); |
| | | } catch (Exception e) { |
| | |
| | | orderScheduling.setReport10("1"); |
| | | int i = bsOrderSchedulingService.updateBsOrderScheduling(orderScheduling); |
| | | logger.info("{}åç®±æ¥å·¥æå",orderScheduling.getOrderNo()); |
| | | orderScheduling.setRemarks("åç®±æ¥å·¥æå"); |
| | | }else { |
| | | if(StringUtils.isEmpty(orderScheduling.getSpareField1())){ |
| | | orderScheduling.setSpareField1("1"); |
| | |
| | | }else { |
| | | orderScheduling.setSpareField1(String.valueOf(Integer.valueOf(orderScheduling.getSpareField1()) + 1)); |
| | | } |
| | | if(status.equals("3")){ |
| | | orderScheduling.setRemarks("åç®±æ¥å·¥å 为ç½ç»åå ï¼æ¥å·¥å¤±è´¥"); |
| | | logger.info("{}åç®±æ¥å·¥å 为ç½ç»åå ï¼æ¥å·¥å¤±è´¥ï¼",orderScheduling.getOrderNo()); |
| | | } else{ |
| | | orderScheduling.setRemarks("åç®±æ¥å·¥å¤±è´¥"+ev_meassage); |
| | | logger.info("{}åç®±æ¥å·¥å¤±è´¥,åå ï¼{}",orderScheduling.getOrderNo(),ev_meassage); |
| | | } |
| | | bsOrderSchedulingService.updateBsOrderScheduling(orderScheduling); |
| | | } |
| | | if(status.equals("3")) |
| | | logger.info("{}åç®±æ¥å·¥å 为ç½ç»åå ï¼æ¥å·¥å¤±è´¥ï¼",orderScheduling.getOrderNo()); |
| | | else |
| | | logger.info("{}åç®±æ¥å·¥å¤±è´¥,åå ï¼{}",orderScheduling.getOrderNo(),ev_meassage); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | if (CollUtil.isNotEmpty(bsOrderSchedulings)){ |
| | | BsOrderScheduling orderScheduling = bsOrderSchedulings.get(0); |
| | | try { |
| | | String xmlResult = ReceivingServices.getInterfaceInformationXml(url, getProductionPlanInformationXml(orderScheduling.getOrderNo(), "0020")); |
| | | String xmlResult = ReceivingServices.getInterfaceInformationXml(url, getProductionPlanInformationXml(orderScheduling.getOrderNo(), orderScheduling.getEngineNo(),"0020")); |
| | | ev_meassage=ReceivingServices.xmlToJSON1(xmlResult); |
| | | status = ReceivingServices.xmlToJSON3(xmlResult); |
| | | } catch (Exception e) { |
| | |
| | | orderScheduling.setReport20("1"); |
| | | int i = bsOrderSchedulingService.updateBsOrderScheduling(orderScheduling); |
| | | logger.info("{}æ»è£
æ¥å·¥æå",orderScheduling.getOrderNo()); |
| | | orderScheduling.setRemarks("æ»è£
æ¥å·¥æå"); |
| | | }else { |
| | | if(StringUtils.isEmpty(orderScheduling.getSpareField2())){ |
| | | orderScheduling.setSpareField2("1"); |
| | |
| | | }else{ |
| | | orderScheduling.setSpareField2(String.valueOf(Integer.valueOf(orderScheduling.getSpareField2()) + 1)); |
| | | } |
| | | bsOrderSchedulingService.updateBsOrderScheduling(orderScheduling); |
| | | if(status.equals("3")) |
| | | if(status.equals("3")){ |
| | | logger.info("{}æ»è£
æ¥å·¥å 为ç½ç»åå ï¼æ¥å·¥å¤±è´¥ï¼",orderScheduling.getOrderNo()); |
| | | else |
| | | orderScheduling.setRemarks("æ»è£
æ¥å·¥å 为ç½ç»åå ï¼æ¥å·¥å¤±è´¥"); |
| | | } else{ |
| | | logger.info("{}æ»è£
æ¥å·¥å¤±è´¥,åå ï¼{}",orderScheduling.getOrderNo(),ev_meassage); |
| | | orderScheduling.setRemarks("æ»è£
æ¥å·¥å¤±è´¥,"+ev_meassage); |
| | | } |
| | | bsOrderSchedulingService.updateBsOrderScheduling(orderScheduling); |
| | | } |
| | | } |
| | | } |
| | |
| | | //æ´æ° |
| | | //å¤ææ¯å¦éè¦æ´æ° |
| | | ProductNumTable productNumTable = collect1.get(0); |
| | | Integer hxOnlineNum = productNumTable.getHxOnlineNum(); |
| | | Integer zzOnlineNum = productNumTable.getZzOnlineNum(); |
| | | Integer zzOfflineNum = productNumTable.getZzOfflineNum(); |
| | | if (!hxOnlineNum.equals((int)count1) || !zzOnlineNum.equals((int) count2) || !zzOfflineNum.equals((int)count3)){ |
| | | //æ´æ° |
| | | productNumTable.setHxOnlineNum((int) count1); |
| | | productNumTable.setZzOnlineNum((int) count2); |
| | | productNumTable.setZzOfflineNum((int) count3); |
| | | productNumTable.setProductNumTheory(productNumTheory); |
| | | productNumTableService.updateProductNum(productNumTable); |
| | | } |
| | | // Integer hxOnlineNum = productNumTable.getHxOnlineNum(); |
| | | // Integer zzOnlineNum = productNumTable.getZzOnlineNum(); |
| | | // Integer zzOfflineNum = productNumTable.getZzOfflineNum(); |
| | | // if (!hxOnlineNum.equals((int)count1) || !zzOnlineNum.equals((int) count2) || !zzOfflineNum.equals((int)count3)){ |
| | | // |
| | | // } |
| | | //æ´æ° |
| | | productNumTable.setHxOnlineNum((int) count1); |
| | | productNumTable.setZzOnlineNum((int) count2); |
| | | productNumTable.setZzOfflineNum((int) count3); |
| | | productNumTable.setProductNumTheory(productNumTheory); |
| | | productNumTableService.updateProductNum(productNumTable); |
| | | } |
| | | } |
| | | if (CollUtil.isNotEmpty(saveDate)){ |
| | |
| | | return productNumTheory; |
| | | } |
| | | |
| | | public static String getProductionPlanInformationXml(String orderNo,String location){ |
| | | public static String getProductionPlanInformationXml(String orderNo,String engineNo,String location){ |
| | | String content = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sap-com:document:sap:rfc:functions\">\n" + |
| | | " <soapenv:Header/>\n" + |
| | | " <soapenv:Body>\n" + |
| | | " <urn:ZPP_BC_001>\n" + |
| | | " <IV_AUFNR>"+orderNo+"</IV_AUFNR>\n" + |
| | | " <IV_VORNR>"+location+"</IV_VORNR>\n" + |
| | | " <IV_ZFDJM>"+engineNo+"</IV_ZFDJM>\n" + |
| | | " <IV_LMNGA>1</IV_LMNGA>\n" + |
| | | " <IV_XMNGA>0</IV_XMNGA> \n" + |
| | | " <IV_STATU>1</IV_STATU> \n" + |
| | |
| | | method: 'delete' |
| | | }) |
| | | } |
| | | export function queryChart(query) { |
| | | return request({ |
| | | url: '/main/paramCollection/queryChart', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | export function getSelectOption(query) { |
| | | return request({ |
| | | url: '/main/paramCollection/getSelectOption', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-card class="box-card"> |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px"> |
| | | <el-form-item label="æ¥æèå´" prop="dateConditions"> |
| | | <el-date-picker |
| | | v-model="queryParams.dateConditions" |
| | | type="daterange" |
| | | align="right" |
| | | unlink-panels |
| | | range-separator="è³" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | value-format="yyyy-MM-dd" |
| | | @change="handleDateChange"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item label="å·¥ä½ç¼å·" prop="locationCode"> |
| | | <el-select v-model="queryParams.locationCode" placeholder="请éæ©å·¥ä½ç¼å·" clearable> |
| | | <el-option |
| | | v-for="item in locationOption" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ°æ®ç±»å" prop="paramName"> |
| | | <el-select v-model="queryParams.paramName" @change="getSelectOptionMethod" placeholder="请éæ©æ°æ®ç±»å" clearable> |
| | | <el-option |
| | | v-for="item in dataTypeList" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="èºæ å称" prop="paramCode"> |
| | | <el-select v-model="queryParams.paramCode" placeholder="请éæ©èºæ å称" clearable> |
| | | <el-option |
| | | v-for="item in screwNameList" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | |
| | | <el-form-item style="float: right"> |
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="queryChartMethod">æç´¢</el-button> |
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-card> |
| | | <el-card style="margin-top: 10px" class="box-card"> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-tabs v-model="activeName" @tab-click="handleClick"> |
| | | <el-tab-pane label="ç¨æ·ç®¡ç" name="first">ç¨æ·ç®¡ç</el-tab-pane> |
| | | <el-tab-pane label="é
置管ç" name="second">é
置管ç</el-tab-pane> |
| | | <el-tab-pane label="è§è²ç®¡ç" name="third">è§è²ç®¡ç</el-tab-pane> |
| | | </el-tabs> |
| | | </el-row> |
| | | |
| | | <el-table v-loading="loading" border :data="paramCollectionList" @selection-change="handleSelectionChange" v-if="paramCollectionList.length > 0"> |
| | | |
| | | </el-table> |
| | | <el-empty v-else> |
| | | <span slot="description">ææ æ°æ®</span> |
| | | </el-empty> |
| | | </el-card> |
| | | |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { listParamCollection, getParamCollection, delParamCollection, addParamCollection, updateParamCollection } from "@/api/main/da/paramCollection/paramCollection"; |
| | | import {queryDaParamCollectionListForSearch, getSelectOption, queryChart} from "../../../../api/main/da/paramCollection/paramCollection"; |
| | | |
| | | export default { |
| | | name: "ParamCollection", |
| | | data() { |
| | | return { |
| | | activeName: 'second', |
| | | dataTypeList:[ |
| | | { |
| | | value: "æç©", |
| | | label: "æç©" |
| | | }, |
| | | { |
| | | value: "è§åº¦", |
| | | label: "è§åº¦" |
| | | }, |
| | | ], |
| | | locationOption:[], |
| | | screwNameList:[], |
| | | maxDate: '', |
| | | // é®ç½©å± |
| | | loading: true, |
| | | // éä¸æ°ç» |
| | | ids: [], |
| | | // éå个ç¦ç¨ |
| | | single: true, |
| | | // éå¤ä¸ªç¦ç¨ |
| | | multiple: true, |
| | | // æ¾ç¤ºæç´¢æ¡ä»¶ |
| | | showSearch: true, |
| | | // æ»æ¡æ° |
| | | total: 0, |
| | | // 设å¤äº§åè¿ç¨åæ°ééè¡¨æ ¼æ°æ® |
| | | paramCollectionList: [], |
| | | // å¼¹åºå±æ é¢ |
| | | title: "", |
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå± |
| | | open: false, |
| | | // æ¥è¯¢åæ° |
| | | queryParams: { |
| | | dateConditions: [], |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | workOrderNo: null, |
| | | sfcCode: null, |
| | | productCode: null, |
| | | productionLine: null, |
| | | locationCode: null, |
| | | equipmentNo: null, |
| | | paramCode: null, |
| | | }, |
| | | // 表ååæ° |
| | | form: {}, |
| | | // 表åæ ¡éª |
| | | rules: { |
| | | id: [ |
| | | { required: true, message: "主é®idä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | // workOrderNo: [ |
| | | // { required: true, message: "å·¥åç¼å·ä¸è½ä¸ºç©º", trigger: "blur" } |
| | | // ], |
| | | sfcCode: [ |
| | | { required: true, message: "æ»æåºåå·ä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | productCode: [ |
| | | { required: true, message: "产åç¼å·ä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | // productionLine: [ |
| | | // { required: true, message: "产线ç¼å·ä¸è½ä¸ºç©º", trigger: "blur" } |
| | | // ], |
| | | locationCode: [ |
| | | { required: true, message: "å·¥ä½ç¼å·ä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | paramCode: [ |
| | | { required: true, message: "åæ°ç¼ç ä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | paramValue: [ |
| | | { required: true, message: "åæ°å¼ä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | } |
| | | }; |
| | | }, |
| | | created() { |
| | | // this.getList(); |
| | | }, |
| | | mounted() { |
| | | this.getSelectOptionMethod() |
| | | }, |
| | | methods: { |
| | | getSelectOptionMethod(){ |
| | | getSelectOption(this.queryParams).then(res => { |
| | | console.log('rrrrrrr',res) |
| | | if (res.code === 200){ |
| | | this.locationOption = res.data.locationList |
| | | this.screwNameList = res.data.paramCodeList |
| | | } |
| | | }) |
| | | }, |
| | | queryChartMethod(){ |
| | | queryChart(this.queryParams).then(res => { |
| | | if (res.code === 200){ |
| | | console.log('res',res) |
| | | let dataArray = [] |
| | | if (res.data.length > 0){ |
| | | res.data.forEach(x => { |
| | | let num = parseInt(x) |
| | | dataArray.push(num) |
| | | }) |
| | | } |
| | | console.log('res222',dataArray) |
| | | let array=dataArray |
| | | console.log('arra',array) |
| | | // å¹³åå¼ |
| | | let mean=(array.reduce((a,b)=>a+b))/array.length |
| | | console.log('mean',mean) |
| | | // æ¹å·® |
| | | let variance=array.map(x=>{ |
| | | return Math.pow(x-mean,2) |
| | | }).reduce((a,b)=>a+b)/array.length |
| | | console.log('variance',variance) |
| | | // æ åå·® |
| | | let StandardDeviation = Math.sqrt(variance) |
| | | console.log('StandardDeviation',StandardDeviation) |
| | | //计ç®æ¹å¼å¯ä»¥ç¾åº¦ |
| | | let convertedData=[] |
| | | for(let x=mean-3*StandardDeviation;x<=mean + 3*StandardDeviation;x++){ |
| | | //for循ç¯ä¸çæ¡ä»¶ä»£è¡¨ä½ è¦çæå 个æ åå·®çæ°æ®ï¼ |
| | | // å带å
¥æ£æåå¸å
¬å¼ï¼å°±å¯ä»¥çæä¸æ¡æ´æ¡åå¸æ²çº¿çæ°æ® |
| | | let y=1/(StandardDeviation*Math.sqrt(2*(Math.PI)))*Math.exp(-(Math.pow(x-mean,2))/(2*(Math.pow(StandardDeviation,2)))) |
| | | convertedData.push([x,y]) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | handleClick(tab, event) { |
| | | console.log(tab, event); |
| | | }, |
| | | handleDateChange(value) { |
| | | if (value && value.length === 2) { |
| | | const startDate = value[0]; |
| | | const endDate = value[1]; |
| | | const dayCount = this.daysBetween(startDate, endDate); |
| | | if (dayCount + 1 > 7) { |
| | | this.$message.error('请éæ©è¿ç»ç7天ï¼'); |
| | | this.queryParams.dateConditions = []; // éç½®æ¥æèå´ |
| | | } |
| | | } |
| | | }, |
| | | daysBetween(startDate, endDate) { |
| | | const oneDay = 24 * 60 * 60 * 1000; // æ¯å¤©ç毫ç§æ° |
| | | const startTime = new Date(startDate).getTime(); |
| | | const endTime = new Date(endDate).getTime(); |
| | | return Math.round(Math.abs((startTime - endTime) / oneDay)); |
| | | }, |
| | | /** æ¥è¯¢è®¾å¤äº§åè¿ç¨åæ°ééå表 */ |
| | | getList() { |
| | | this.loading = true; |
| | | if ((this.queryParams.sfcCode == null || this.queryParams.sfcCode === '') && this.queryParams.dateConditions.length === 0){ |
| | | this.$message({ |
| | | message: '请è¾å
¥åå¨æºå·ç æè
éæ©æ¥è¯¢æ¥æ', |
| | | type: 'info' |
| | | }); |
| | | } else { |
| | | queryDaParamCollectionListForSearch(this.queryParams).then(response => { |
| | | this.paramCollectionList = response.rows; |
| | | this.total = response.total; |
| | | this.loading = false; |
| | | }); |
| | | } |
| | | |
| | | }, |
| | | // åæ¶æé® |
| | | cancel() { |
| | | this.open = false; |
| | | this.reset(); |
| | | }, |
| | | // 表åéç½® |
| | | reset() { |
| | | this.form = { |
| | | id: null, |
| | | workOrderNo: null, |
| | | sfcCode: null, |
| | | productCode: null, |
| | | productionLine: null, |
| | | locationCode: null, |
| | | equipmentNo: null, |
| | | paramCode: null, |
| | | paramValue: null, |
| | | paramUpper: null, |
| | | paramLower: null, |
| | | paramStandard: null, |
| | | collectionTime: null, |
| | | spareField1: null, |
| | | spareField2: null, |
| | | createUser: null, |
| | | createTime: null, |
| | | updateUser: null, |
| | | updateTime: null, |
| | | state: null, |
| | | paramName: null, |
| | | unit: null, |
| | | type: null |
| | | }; |
| | | this.resetForm("form"); |
| | | }, |
| | | /** æç´¢æé®æä½ */ |
| | | handleQuery() { |
| | | this.queryParams.pageNum = 1; |
| | | this.getList(); |
| | | }, |
| | | /** éç½®æé®æä½ */ |
| | | resetQuery() { |
| | | this.resetForm("queryForm"); |
| | | this.handleQuery(); |
| | | }, |
| | | // å¤éæ¡éä¸æ°æ® |
| | | handleSelectionChange(selection) { |
| | | this.ids = selection.map(item => item.id) |
| | | this.single = selection.length!==1 |
| | | this.multiple = !selection.length |
| | | }, |
| | | /** æ°å¢æé®æä½ */ |
| | | handleAdd() { |
| | | this.reset(); |
| | | this.open = true; |
| | | this.title = "æ·»å 设å¤äº§åè¿ç¨åæ°éé"; |
| | | }, |
| | | /** ä¿®æ¹æé®æä½ */ |
| | | handleUpdate(row) { |
| | | this.reset(); |
| | | const id = row.id || this.ids |
| | | getParamCollection(id).then(response => { |
| | | this.form = response.data; |
| | | this.open = true; |
| | | this.title = "ä¿®æ¹è®¾å¤äº§åè¿ç¨åæ°éé"; |
| | | }); |
| | | }, |
| | | /** æ交æé® */ |
| | | submitForm() { |
| | | this.$refs["form"].validate(valid => { |
| | | if (valid) { |
| | | if (this.form.id != null) { |
| | | updateParamCollection(this.form).then(response => { |
| | | this.$modal.msgSuccess("ä¿®æ¹æå"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } else { |
| | | addParamCollection(this.form).then(response => { |
| | | this.$modal.msgSuccess("æ°å¢æå"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | /** å é¤æé®æä½ */ |
| | | handleDelete(row) { |
| | | const ids = row.id || this.ids; |
| | | this.$modal.confirm('æ¯å¦ç¡®è®¤å é¤è®¾å¤äº§åè¿ç¨åæ°ééç¼å·ä¸º"' + ids + '"çæ°æ®é¡¹ï¼').then(function() { |
| | | return delParamCollection(ids); |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.$modal.msgSuccess("å é¤æå"); |
| | | }).catch(() => {}); |
| | | }, |
| | | /** 导åºæé®æä½ */ |
| | | handleExport() { |
| | | this.download('main/paramCollection/export', { |
| | | ...this.queryParams |
| | | }, `paramCollection_${new Date().getTime()}.xlsx`) |
| | | } |
| | | } |
| | | }; |
| | | </script> |