pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProParamsMapper.java
@@ -55,4 +55,5 @@ Long selectSomeCount(Map<String, Object> params); List<PltProductParams> selectSome(Map<String, Object> params); List<PltProductParams> selectParams(Long proId); } pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java
@@ -3,6 +3,8 @@ import com.dy.pmsGlobal.pojoPlt.PltProductFile; import org.apache.ibatis.annotations.Mapper; import java.util.List; @Mapper public interface PltProductFileMapper { @@ -12,6 +14,8 @@ PltProductFile selectByPrimaryKey(Long id); List<PltProductFile> selectDocuments(Long proId); int updateByPrimaryKeySelective(PltProductFile record); int updateByPrimaryKey(PltProductFile record); pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaDeviceLifeMapper.java
@@ -3,6 +3,8 @@ import com.dy.pmsGlobal.pojoSta.StaDeviceLife; import org.apache.ibatis.annotations.Mapper; import java.util.List; /** * @author User * @description 针对表【sta_device_life(设备生命周期表)】的数据库操作Mapper @@ -24,4 +26,5 @@ int updateByPrimaryKey(StaDeviceLife record); List<StaDeviceLife> selectByEquipNo(String deviceNo); } pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaDeviceProductionLogMapper.java
@@ -3,6 +3,8 @@ import com.dy.pmsGlobal.pojoSta.StaDeviceProductionLog; import org.apache.ibatis.annotations.Mapper; import java.util.List; /** * @author User * @description 针对表【sta_device_production_log(设备生产日志表)】的数据库操作Mapper @@ -20,6 +22,8 @@ StaDeviceProductionLog selectByPrimaryKey(Long id); List<StaDeviceProductionLog> selectByEquipNo(String equipNo); int updateByPrimaryKeySelective(StaDeviceProductionLog record); int updateByPrimaryKey(StaDeviceProductionLog record); pms-parent/pms-global/src/main/resources/mapper/PltProParamsMapper.xml
@@ -21,6 +21,12 @@ from plt_product_params where id = #{id,jdbcType=BIGINT} </select> <select id="selectParams" parameterType="java.lang.Long" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from plt_product_params where pro_id = #{proId,jdbcType=BIGINT} and deleted !=1 </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <!--@mbg.generated--> delete from plt_product_params pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml
@@ -22,7 +22,12 @@ from plt_product_file where id = #{id,jdbcType=BIGINT} </select> <select id="selectDocuments" parameterType="java.lang.Long" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from plt_product_file where pro_id = #{proId,jdbcType=BIGINT} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> delete from plt_product_file where id = #{id,jdbcType=BIGINT} pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml
@@ -21,15 +21,32 @@ select="com.dy.pmsGlobal.daoBa.BaUserMapper.selectNameByUserId" fetchType="eager" /> <association property="stationName" column="station_id" javaType="java.lang.Long" select="com.dy.pmsGlobal.daoPlt.PltStationMapper.selectNameByStationId" fetchType="eager" /> <association property="planName" column="plan_id" javaType="java.lang.Long" select="com.dy.pmsGlobal.daoPr.PrAssemblyPlanMapper.selectNameByPlanId" fetchType="eager" /> <association property="processName" column="process_id" javaType="java.lang.Long" select="com.dy.pmsGlobal.daoPr.PrProductionProcessMapper.selectProcessNameById" fetchType="eager" /> <association property="nodeName" column="node_id" javaType="java.lang.Long" select="com.dy.pmsGlobal.daoPr.PrProductionNodeMapper.selectNameByNodeId" fetchType="eager" /> <association property="lineName" column="line_id" javaType="java.lang.Long" select="com.dy.pmsGlobal.daoPlt.PltProductionLineMapper.selectNameByLineId" fetchType="eager" /> <collection property="assistantsList" ofType="com.dy.pmsGlobal.pojoBa.BaUser" select="com.dy.pmsGlobal.daoBa.BaUserMapper.selectByAssistants" fetchType="eager" column="assistants" /> </resultMap> <resultMap id="SelectResultMap" type="com.dy.pmsGlobal.pojoSta.StaAssemblyWorkLast"> <id property="id" column="id" jdbcType="BIGINT"/> <result property="userId" column="user_id" jdbcType="BIGINT"/> <result property="lineId" column="line_id" jdbcType="BIGINT"/> <result property="stationId" column="station_id" jdbcType="BIGINT"/> <result property="planId" column="plan_id" jdbcType="BIGINT"/> <result property="processId" column="process_id" jdbcType="BIGINT"/> <result property="nodeId" column="node_id" jdbcType="BIGINT"/> <result property="dt" column="dt" jdbcType="TIMESTAMP"/> <result property="status" column="status" jdbcType="TINYINT"/> <result property="startTime" column="start_time" jdbcType="TIMESTAMP"/> <result property="endTime" column="end_time" jdbcType="TIMESTAMP"/> <result property="assistants" column="assistants" jdbcType="VARCHAR"/> <result property="userName" column="user_name" jdbcType="VARCHAR"/> <result property="stationName" column="station_name" jdbcType="VARCHAR"/> <result property="planName" column="plan_name" jdbcType="VARCHAR"/> <result property="processName" column="process_name" jdbcType="VARCHAR"/> <result property="nodeName" column="node_name" jdbcType="VARCHAR"/> <result property="lineName" column="line_name" jdbcType="VARCHAR"/> <collection property="assistantsList" ofType="com.dy.pmsGlobal.pojoBa.BaUser" select="com.dy.pmsGlobal.daoBa.BaUserMapper.selectByAssistants" fetchType="eager" column="assistants" /> </resultMap> @@ -122,11 +139,17 @@ </where> order by id desc </select> <select id="selectSome" resultMap="BaseResultMap"> <select id="selectSome" resultMap="SelectResultMap"> select <include refid="part_Column_List" > <property name="alias" value="l"/> </include> </include>, u.name as user_name, s.name as station_name, p.name as plan_name, pp.name as process_name, n.content as node_name, ll.name as line_name from sta_assembly_work_last l left join ba_user u on l.user_id = u.id left join plt_station s on l.station_id = s.id pms-parent/pms-global/src/main/resources/mapper/StaDeviceLifeMapper.xml
@@ -40,6 +40,14 @@ where id = #{id,jdbcType=BIGINT} </select> <select id="selectByEquipNo" parameterType="java.lang.String" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from sta_device_life where equip_no = #{equipNo,jdbcType=VARCHAR} order by id desc </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> delete from sta_device_life where id = #{id,jdbcType=BIGINT} pms-parent/pms-global/src/main/resources/mapper/StaDeviceProductionLogMapper.xml
@@ -40,6 +40,14 @@ where id = #{id,jdbcType=BIGINT} </select> <select id="selectByEquipNo" parameterType="java.lang.String" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from sta_device_production_log where equip_no = #{equipNo,jdbcType=VARCHAR} order by id desc </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> delete from sta_device_production_log where id = #{id,jdbcType=BIGINT} pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/config/WebFilterConfiguration.java
New file @@ -0,0 +1,41 @@ package com.dy.pmsReport.config; import com.dy.common.webFilter.DevStageFilter; import com.dy.common.webFilter.UserTokenFilter; import jakarta.servlet.Filter; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class WebFilterConfiguration { @Value("${pms.global.dev}") public String isDevStage ;//是否为开发阶段 /** * 启动顺序 */ private static final int order_UserTokenFilter = 1 ; private static final int order_DevStageFilter = 100 ; @Bean public FilterRegistrationBean<? extends Filter> regFilter() { FilterRegistrationBean<Filter> filterRegistrationBean = new FilterRegistrationBean<>(); if(this.isDevStage != null && !this.isDevStage.trim().equals("") && this.isDevStage.trim().equalsIgnoreCase("true")){ filterRegistrationBean.setFilter(new DevStageFilter()); filterRegistrationBean.addUrlPatterns("/*");//配置过滤规则 filterRegistrationBean.setName("devStageFilter");//设置过滤器名称 filterRegistrationBean.setOrder(order_DevStageFilter);//执行次序 }else{ filterRegistrationBean.setFilter(new UserTokenFilter()); filterRegistrationBean.addUrlPatterns("/*");//配置过滤规则 filterRegistrationBean.setName("UserTokenFilter");//设置过滤器名称 filterRegistrationBean.setOrder(order_UserTokenFilter);//执行次序 } return filterRegistrationBean; } } pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/config/WebListenerConfiguration.java
New file @@ -0,0 +1,50 @@ package com.dy.pmsReport.config; import com.dy.common.webListener.GenerateIdSetSuffixListener; import jakarta.servlet.ServletContextListener; import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class WebListenerConfiguration { /** * 启动顺序 */ //private static final int order_config = 0 ; private static final int order_idSetSuffix = 1 ; /* * 解析各种***config.xml配置的ConfigListener,当前springboot工程暂时不采用此种配置方式 * @Bean public ConfigListener getGlConfigListener(){ return new ConfigListener() ; } /** * 外部提供Listener * @param listener 外部提供Listener * @return 注册Bean @Bean public ServletListenerRegistrationBean<? extends ServletContextListener> regConfigListener(ConfigListener listener) { ServletListenerRegistrationBean<ConfigListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); listenerRegistrationBean.setListener(listener); listenerRegistrationBean.setOrder(order_config); return listenerRegistrationBean; } */ /** * 内部提供listener,该listener在系统启动时,根据配置 设置ID产生器的后缀 * @return 注册Bean */ @Bean public ServletListenerRegistrationBean<? extends ServletContextListener> regIdSuffixListener() { ServletListenerRegistrationBean<GenerateIdSetSuffixListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); listenerRegistrationBean.setListener(new GenerateIdSetSuffixListener()); listenerRegistrationBean.setOrder(order_idSetSuffix); return listenerRegistrationBean; } } pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/deviceReport/DeviceReportCtl.java
New file @@ -0,0 +1,32 @@ package com.dy.pmsReport.deviceReport; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; import lombok.extern.slf4j.Slf4j; 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.RestController; import java.util.Map; /** *报表返回设备信息 */ @Slf4j @RestController @RequestMapping(path = "device") public class DeviceReportCtl { private DeviceReportSv sv; @Autowired public void setSv(DeviceReportSv sv) { this.sv = sv; } @GetMapping(path = "getDeviceInfo") public BaseResponse<Map<String, Object>> getDeviceInfo(String deviceNo) { log.info("DeviceReportCtl.getDeviceInfo()"); Map<String, Object> result = sv.getDeviceInfo(deviceNo); return BaseResponseUtils.buildSuccess(result); } } pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/deviceReport/DeviceReportSv.java
New file @@ -0,0 +1,79 @@ package com.dy.pmsReport.deviceReport; import com.alibaba.excel.util.StringUtils; import com.dy.pmsGlobal.daoSta.*; import com.dy.pmsGlobal.pojoSta.StaDeviceLast; import com.dy.pmsGlobal.pojoSta.StaDeviceLife; import com.dy.pmsGlobal.pojoSta.StaDeviceProductionLog; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.HashMap; import java.util.List; import java.util.Map; @Slf4j @Service public class DeviceReportSv { private StaDeviceLastMapper deviceLastDao; private StaDeviceLifeMapper deviceLifeDao; private StaWipSnExMapper wipSnExDao; private StaDeviceProductionLogMapper deviceProductionLogDao; private StaRepairInfoMapper repairInfoDao; @Autowired public void setDeviceLastDao(StaDeviceLastMapper deviceLastDao) { this.deviceLastDao = deviceLastDao; } @Autowired public void setDeviceLifeDao(StaDeviceLifeMapper deviceLifeDao) { this.deviceLifeDao = deviceLifeDao; } @Autowired public void setWipSnExDao(StaWipSnExMapper wipSnExDao) { this.wipSnExDao = wipSnExDao; } @Autowired public void setDeviceProductionLogDao(StaDeviceProductionLogMapper deviceProductionLogDao) { this.deviceProductionLogDao = deviceProductionLogDao; } @Autowired public void setRepairInfoDao(StaRepairInfoMapper repairInfoDao) { this.repairInfoDao = repairInfoDao; } public Map<String, Object> getDeviceInfo(String deviceNo) { if (StringUtils.isBlank(deviceNo)) { return null; } // 查询设备信息 StaDeviceLast deviceLast = deviceLastDao.selectByDeviceNo(deviceNo); if (deviceLast == null) { return null; } Map<String, Object> deviceInfo =new HashMap<>(); deviceInfo.put("deviceInfo", deviceLast); //查询设备日志 List<StaDeviceProductionLog> log = deviceProductionLogDao.selectByEquipNo(deviceNo); deviceInfo.put("deviceLog", log); // 查询设备生命周期 List<StaDeviceLife> deviceLife = deviceLifeDao.selectByEquipNo(deviceNo); deviceInfo.put("deviceLife", log); // 查询设备维修信息 /*StaRepairInfo repairInfo = repairInfoDao.selectByDeviceNo(deviceNo); if (preRecord.getStatus() == 1) { if (repairInfo == null) { return null; } // 查询设备维修信息 StaWipSnEx wipSnEx = wipSnExDao.selectByDeviceNo(); } return DeviceReportDao.getDeviceInfo(deviceNo);*/ return deviceInfo; } } pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepCtrl.java
@@ -2,8 +2,11 @@ import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; import com.dy.pmsGlobal.pojoPlt.PltProductFile; import com.dy.pmsGlobal.pojoPlt.PltProductParams; import com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems; import com.dy.pmsGlobal.pojoPlt.PltProductTestInspectionItems; import com.dy.pmsGlobal.pojoPr.PrProductionNode; import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -45,6 +48,36 @@ return BaseResponseUtils.buildSuccess(true); } } /** * 根据节点的查出节点作业指导书 * @param * @return */ @GetMapping(path="getSopByNodeId") public BaseResponse<PrProductionNode> getSopByNodeId(String nodeId){ PrProductionNode result = sv.getSopByNodeId(nodeId); return BaseResponseUtils.buildSuccess(result); } /** * 根据产品查出 主要技术参数 * @param * @return */ @GetMapping(path="getParamsByProId") public BaseResponse<List<PltProductParams>> getParamsByProId(String proId){ List<PltProductParams> result = sv.getParamsByProId(proId); return BaseResponseUtils.buildSuccess(result); } /** * 根据产品查出产品文件 主要技术参数 * @param * @return */ @GetMapping(path="getFileByProId") public BaseResponse<List<PltProductFile>> getFileByProId(String proId){ List<PltProductFile> result = sv.getFileByProId(proId); return BaseResponseUtils.buildSuccess(result); } @GetMapping(path = "getQualityItems") public BaseResponse<List<PltProductQualityInspectionItems>> getQualityItems(String proId) { log.info("AssemblyStepCtrl.getQualityItems()"); pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java
@@ -2,23 +2,25 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.dy.pmsGlobal.daoPlt.PltProductMapper; import com.dy.pmsGlobal.daoPlt.PltProductQualityInspectionItemsMapper; import com.dy.pmsGlobal.daoPlt.PltProductTestInspectionItemsMapper; import com.dy.pmsGlobal.daoOth.OthFileMapper; import com.dy.pmsGlobal.daoPlt.*; import com.dy.pmsGlobal.daoPr.PrAssemblyPlanMapper; import com.dy.pmsGlobal.daoPr.PrProductionNodeMapper; import com.dy.pmsGlobal.daoSta.*; import com.dy.pmsGlobal.pojoPlt.PltProduct; import com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems; import com.dy.pmsGlobal.pojoPlt.PltProductTestInspectionItems; import com.dy.pmsGlobal.dyFile.FileOperate; import com.dy.pmsGlobal.dyFile.FileRestVo; import com.dy.pmsGlobal.pojoOth.OthFile; import com.dy.pmsGlobal.pojoPlt.*; import com.dy.pmsGlobal.pojoPr.PrAssemblyPlan; import com.dy.pmsGlobal.pojoPr.PrProductionNode; import com.dy.pmsGlobal.pojoPr.PrWorkingInstruction; import com.dy.pmsGlobal.pojoSta.*; import com.dy.pmsGlobal.util.DeviceStatus; import com.dy.pmsGlobal.util.QrCodeConstant; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -44,6 +46,12 @@ private PltProductQualityInspectionItemsMapper qualityItemsDao; private PltProductTestInspectionItemsMapper testItemsDao; private PltProductMapper productDao; private PltProParamsMapper paramsDao; private PltProductFileMapper productFileDao; private FileOperate fileOperate; private OthFileMapper othFileMapper; @Value("${dy.webFile.fmUrl}") private String fmUrl; @Autowired public void setDeviceLastDao(StaDeviceLastMapper deviceLastDao) { this.deviceLastDao = deviceLastDao; @@ -87,6 +95,26 @@ @Autowired public void setProductDao(PltProductMapper productDao) { this.productDao = productDao; } @Autowired public void setParamsDao(PltProParamsMapper paramsDao) { this.paramsDao = paramsDao; } @Autowired public void setProductFileDao(PltProductFileMapper productFileDao) { this.productFileDao = productFileDao; } @Autowired public void setFileOperate(FileOperate fileOperate) { this.fileOperate = fileOperate; } @Autowired public void setOthFileMapper(OthFileMapper othFileMapper) { this.othFileMapper = othFileMapper; } @Transactional @@ -258,6 +286,46 @@ saveDeviceProductionLog(deviceLast); return count; } //根据节点查出节点作业指导书 public PrProductionNode getSopByNodeId(String nodeId) { if(com.alibaba.excel.util.StringUtils.isBlank(nodeId)){ throw new RuntimeException("节点ID不能为空"); } PrProductionNode node = nodeDao.selectByPrimaryKey(Long.parseLong(nodeId)); if(node == null){ throw new RuntimeException("节点ID不存在,请检查"); } if(node.instruction != null){ addUrl(node.instruction); } return node; } //主要技术参数 俩个方法同 platform-->product-->productSv public List<PltProductParams> getParamsByProId(String proId) { if(StringUtils.isBlank(proId)){ throw new RuntimeException("产品ID不能为空"); } List<PltProductParams> proParams = paramsDao.selectParams(Long.parseLong(proId)); return proParams; } // 根据产品查出产品文件 public List<PltProductFile> getFileByProId(String proId) { if(StringUtils.isBlank(proId)){ throw new RuntimeException("产品ID不能为空"); } List<PltProductFile> proFiles = productFileDao.selectDocuments(Long.parseLong(proId)); proFiles.stream().forEach(doc -> { OthFile file = othFileMapper.selectByPrimaryKey(doc.fileId); if (file == null) { return; } FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash); doc.webUrl = fileRestVo.fileSysRestUrl + fileRestVo.fileWebDownloadPath + doc.fileId; doc.orgName = file.orgName; doc.extName = file.extName; }); return proFiles; } public List<PltProductQualityInspectionItems> getQualityItems(String proId) { Map<String, Object> params = new HashMap<>(); @@ -282,4 +350,43 @@ } return false; } private void addUrl(PrWorkingInstruction ins) { if (ins == null || ins.fileId == null) { return; } OthFile file = othFileMapper.selectByPrimaryKey(ins.fileId); if (file == null) { return; } FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash); ins.webUrl = fileRestVo.fileSysRestUrl + fileRestVo.fileWebDownloadPath + ins.fileId; ins.orgName = file.orgName; ins.extName = file.extName; } private PltProduct addWebUrl(PltProduct pro) { if (pro != null) { if (pro.image != null) { String filePathWithWebUrl = getFilePathWithWebUrl(pro.image); pro.imageWebPath = filePathWithWebUrl; pro.imageWebPathZip = fileOperate.getImgFileZipPath(filePathWithWebUrl); } pro.proFiles.stream().forEach(doc -> { OthFile file = othFileMapper.selectByPrimaryKey(doc.fileId); if (file == null) { return; } FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash); doc.webUrl = fileRestVo.fileSysRestUrl + fileRestVo.fileWebDownloadPath + doc.fileId; doc.orgName = file.orgName; doc.extName = file.extName; }); } return pro; } private String getFilePathWithWebUrl(Long fileId) { OthFile file = othFileMapper.selectByPrimaryKey(fileId); FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash); return fileRestVo.fileWebUrl + file.filePath; } } pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderCtrl.java
@@ -3,10 +3,8 @@ import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; import com.dy.pmsGlobal.pojoBa.BaUser; import com.dy.pmsGlobal.pojoPlt.PltProduct; import com.dy.pmsGlobal.pojoPlt.PltStation; import com.dy.pmsGlobal.pojoPr.PrAssemblyPlan; import com.dy.pmsGlobal.pojoPr.PrProductionNode; import com.dy.pmsGlobal.pojoSta.StaAssemblyWorkLast; import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; @@ -157,26 +155,7 @@ List<BaUser> result = sv.updateAssistant(vo); return BaseResponseUtils.buildSuccess(result); } /** * 根据节点的查出节点作业指导书 * @param * @return */ @GetMapping(path="getSopByNodeId") public BaseResponse<PrProductionNode> getSopByNodeId(String nodeId){ PrProductionNode result = sv.getSopByNodeId(nodeId); return BaseResponseUtils.buildSuccess(result); } /** * 根据产品查出产品文件 主要技术参数 * @param * @return */ @GetMapping(path="getFileByProId") public BaseResponse<PltProduct> getFileByProId(String proId){ PltProduct result = sv.getFileByProId(proId); return BaseResponseUtils.buildSuccess(result); } @GetMapping(path = "test") public BaseResponse test() { log.info("test"); pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java
@@ -2,28 +2,21 @@ import com.alibaba.excel.util.StringUtils; import com.dy.pmsGlobal.daoBa.BaUserMapper; import com.dy.pmsGlobal.daoOth.OthFileMapper; import com.dy.pmsGlobal.daoPlt.PltProductMapper; import com.dy.pmsGlobal.daoPlt.PltStationMapper; import com.dy.pmsGlobal.daoPr.PrAssemblyPlanMapper; import com.dy.pmsGlobal.daoPr.PrProductionNodeMapper; import com.dy.pmsGlobal.daoSta.StaAssemblyWorkHistoryMapper; import com.dy.pmsGlobal.daoSta.StaAssemblyWorkLastMapper; import com.dy.pmsGlobal.dyFile.FileOperate; import com.dy.pmsGlobal.dyFile.FileRestVo; import com.dy.pmsGlobal.pojoBa.BaUser; import com.dy.pmsGlobal.pojoOth.OthFile; import com.dy.pmsGlobal.pojoPlt.PltProduct; import com.dy.pmsGlobal.pojoPlt.PltStation; import com.dy.pmsGlobal.pojoPr.PrAssemblyPlan; import com.dy.pmsGlobal.pojoPr.PrProductionNode; import com.dy.pmsGlobal.pojoPr.PrWorkingInstruction; import com.dy.pmsGlobal.pojoSta.StaAssemblyWorkHistory; import com.dy.pmsGlobal.pojoSta.StaAssemblyWorkLast; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -49,10 +42,6 @@ private StaAssemblyWorkHistoryMapper assemblyWorkHistoryDao; private PrProductionNodeMapper nodeDao; private PltProductMapper productDao; private FileOperate fileOperate; private OthFileMapper othFileMapper; @Value("${dy.webFile.fmUrl}") private String fmUrl; @Autowired public void setAssemblyDao(PrAssemblyPlanMapper assemblyDao) { @@ -89,15 +78,6 @@ this.productDao = productDao; } @Autowired public void setFileOperate(FileOperate fileOperate) { this.fileOperate = fileOperate; } @Autowired public void setOthFileMapper(OthFileMapper othFileMapper) { this.othFileMapper = othFileMapper; } public BaUser getUserInfo(String id) { Long userId = null; @@ -154,6 +134,17 @@ List<StaAssemblyWorkLast> workLasts = assemblyWorkLastDao.selectList(param); if (workLasts.size() > 0) { BeanUtils.copyProperties(workLasts.get(0), result); //校验planId processId nodeId /*PrAssemblyPlan assyPlan = assemblyDao.selectByPrimaryKey(workLasts.get(0).getPlanId()); if (assyPlan == null) { throw new RuntimeException("组装任务已经在系统中删除请检查,请先到登出界面解除工站占用 ,再重新扫描"); } boolean hasNodeId = assyPlan.getProcess().getNodes().stream() .anyMatch(node -> node.id.equals(workLasts.get(0).getNodeId())); if (!hasNodeId) { throw new RuntimeException("节点信息有误或被其他人员修改,,请先到登出界面解除工站占用 ,再重新扫描"); } result.setPlan(assyPlan);*/ } else { result.setStationId(stationInfo.getId()); result.setStationName(stationInfo.getName()); @@ -225,6 +216,7 @@ if (!hasNodeId) { throw new RuntimeException("节点信息有误或被其他人员修改,请重新选择节点信息"); } //怎么将只包含这个节点的信息全部回传呢 vo.setLineId(checkResult.getLineId()); StaAssemblyWorkLast staLast = new StaAssemblyWorkLast(); @@ -242,8 +234,8 @@ } else { //保存一条history? BeanUtils.copyProperties(checkResult, staLast); staLast.setPlanId(vo.getPlanId()); staLast.setProcessId(vo.getProcessId()); staLast.setPlanId(assyPlan.getId()); staLast.setProcessId(assyPlan.getProcess().getId()); staLast.setNodeId(vo.getNodeId()); staLast.setStatus(STATUS_NORMAL); staLast.setStartTime(new Date()); @@ -290,20 +282,6 @@ }); });*/ return planList; } private void addUrl(PrWorkingInstruction ins) { if (ins == null || ins.fileId == null) { return; } OthFile file = othFileMapper.selectByPrimaryKey(ins.fileId); if (file == null) { return; } FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash); ins.webUrl = fileRestVo.fileSysRestUrl + fileRestVo.fileWebDownloadPath + ins.fileId; ins.orgName = file.orgName; ins.extName = file.extName; } //workId assistants 传的是单个的userId 必传参数 @@ -391,57 +369,5 @@ return assistantList; } //根据节点查出节点作业指导书 public PrProductionNode getSopByNodeId(String nodeId) { if(StringUtils.isBlank(nodeId)){ throw new RuntimeException("节点ID不能为空"); } PrProductionNode node = nodeDao.selectByPrimaryKey(Long.parseLong(nodeId)); if(node == null){ throw new RuntimeException("节点ID不存在,请检查"); } if(node.instruction != null){ addUrl(node.instruction); } return node; } // 根据产品查出产品文件 主要技术参数 同 platform-->product-->productSv public PltProduct getFileByProId(String proId) { if(StringUtils.isBlank(proId)){ throw new RuntimeException("产品ID不能为空"); } PltProduct product = productDao.selectByPrimaryKey(Long.parseLong(proId)); if(product == null){ throw new RuntimeException("产品ID不存在,请检查"); } product = addWebUrl(product); return product; } private PltProduct addWebUrl(PltProduct pro) { if (pro != null) { if (pro.image != null) { String filePathWithWebUrl = getFilePathWithWebUrl(pro.image); pro.imageWebPath = filePathWithWebUrl; pro.imageWebPathZip = fileOperate.getImgFileZipPath(filePathWithWebUrl); } pro.proFiles.stream().forEach(doc -> { OthFile file = othFileMapper.selectByPrimaryKey(doc.fileId); if (file == null) { return; } FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash); doc.webUrl = fileRestVo.fileSysRestUrl + fileRestVo.fileWebDownloadPath + doc.fileId; doc.orgName = file.orgName; doc.extName = file.extName; }); } return pro; } private String getFilePathWithWebUrl(Long fileId) { OthFile file = othFileMapper.selectByPrimaryKey(fileId); FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash); return fileRestVo.fileWebUrl + file.filePath; } }