From ddd56a8f37eb47d933a7064be9341feb8dbd8165 Mon Sep 17 00:00:00 2001 From: Fancy <Fancy.fx@outlook.com> Date: 星期四, 04 七月 2024 16:51:34 +0800 Subject: [PATCH] edit params and file Api --- pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/deviceReport/DeviceReportCtl.java | 32 +++ pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProParamsMapper.java | 1 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaDeviceLifeMapper.java | 3 pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderCtrl.java | 23 -- pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/deviceReport/DeviceReportSv.java | 79 +++++++ pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/config/WebFilterConfiguration.java | 41 ++++ pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaDeviceProductionLogMapper.java | 4 pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml | 39 +++ pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml | 7 pms-parent/pms-global/src/main/resources/mapper/StaDeviceProductionLogMapper.xml | 8 pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepCtrl.java | 33 +++ pms-parent/pms-global/src/main/resources/mapper/StaDeviceLifeMapper.xml | 8 pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/config/WebListenerConfiguration.java | 50 +++++ pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java | 102 +-------- pms-parent/pms-global/src/main/resources/mapper/PltProParamsMapper.xml | 6 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java | 4 pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java | 119 +++++++++++ 17 files changed, 434 insertions(+), 125 deletions(-) diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProParamsMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProParamsMapper.java index 97a4669..d076f05 100644 --- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProParamsMapper.java +++ b/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); } \ No newline at end of file diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java index 80195e5..533fd1d 100644 --- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductFileMapper.java +++ b/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); diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaDeviceLifeMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaDeviceLifeMapper.java index e128166..c9539da 100644 --- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaDeviceLifeMapper.java +++ b/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 閽堝琛ㄣ�恠ta_device_life(璁惧鐢熷懡鍛ㄦ湡琛�)銆戠殑鏁版嵁搴撴搷浣淢apper @@ -24,4 +26,5 @@ int updateByPrimaryKey(StaDeviceLife record); + List<StaDeviceLife> selectByEquipNo(String deviceNo); } diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaDeviceProductionLogMapper.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaDeviceProductionLogMapper.java index 85f636e..9631ca3 100644 --- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoSta/StaDeviceProductionLogMapper.java +++ b/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 閽堝琛ㄣ�恠ta_device_production_log(璁惧鐢熶骇鏃ュ織琛�)銆戠殑鏁版嵁搴撴搷浣淢apper @@ -20,6 +22,8 @@ StaDeviceProductionLog selectByPrimaryKey(Long id); + List<StaDeviceProductionLog> selectByEquipNo(String equipNo); + int updateByPrimaryKeySelective(StaDeviceProductionLog record); int updateByPrimaryKey(StaDeviceProductionLog record); diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltProParamsMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltProParamsMapper.xml index 0f9eae0..6cac71e 100644 --- a/pms-parent/pms-global/src/main/resources/mapper/PltProParamsMapper.xml +++ b/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 diff --git a/pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml index be4744b..433f8a6 100644 --- a/pms-parent/pms-global/src/main/resources/mapper/PltProductFileMapper.xml +++ b/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} diff --git a/pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml index 1e9f4cf..6c7a823 100644 --- a/pms-parent/pms-global/src/main/resources/mapper/StaAssemblyWorkLastMapper.xml +++ b/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 diff --git a/pms-parent/pms-global/src/main/resources/mapper/StaDeviceLifeMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/StaDeviceLifeMapper.xml index dffccc8..d3936f5 100644 --- a/pms-parent/pms-global/src/main/resources/mapper/StaDeviceLifeMapper.xml +++ b/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} diff --git a/pms-parent/pms-global/src/main/resources/mapper/StaDeviceProductionLogMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/StaDeviceProductionLogMapper.xml index 2388fcf..85978a7 100644 --- a/pms-parent/pms-global/src/main/resources/mapper/StaDeviceProductionLogMapper.xml +++ b/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} diff --git a/pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/config/WebFilterConfiguration.java b/pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/config/WebFilterConfiguration.java new file mode 100644 index 0000000..c6e84c7 --- /dev/null +++ b/pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/config/WebFilterConfiguration.java @@ -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; + } + +} diff --git a/pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/config/WebListenerConfiguration.java b/pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/config/WebListenerConfiguration.java new file mode 100644 index 0000000..33dac56 --- /dev/null +++ b/pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/config/WebListenerConfiguration.java @@ -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 ; + + /* + * 瑙f瀽鍚勭***config.xml閰嶇疆鐨凜onfigListener锛屽綋鍓峴pringboot宸ョ▼鏆傛椂涓嶉噰鐢ㄦ绉嶉厤缃柟寮� + * + @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; + } + +} diff --git a/pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/deviceReport/DeviceReportCtl.java b/pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/deviceReport/DeviceReportCtl.java new file mode 100644 index 0000000..75ad088 --- /dev/null +++ b/pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/deviceReport/DeviceReportCtl.java @@ -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); + } +} diff --git a/pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/deviceReport/DeviceReportSv.java b/pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/deviceReport/DeviceReportSv.java new file mode 100644 index 0000000..ae28116 --- /dev/null +++ b/pms-parent/pms-web-report/src/main/java/com/dy/pmsReport/deviceReport/DeviceReportSv.java @@ -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; + } +} diff --git a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepCtrl.java b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepCtrl.java index 1c86103..48793d7 100644 --- a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepCtrl.java +++ b/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()"); diff --git a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java index 44c26a6..546fbeb 100644 --- a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java +++ b/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; + } } diff --git a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderCtrl.java b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderCtrl.java index 4cb4a24..3e988c0 100644 --- a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderCtrl.java +++ b/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"); diff --git a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java index 908012b..43f84fd 100644 --- a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java +++ b/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 { //淇濆瓨涓�鏉istory? 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; - } } \ No newline at end of file -- Gitblit v1.8.0