pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPr/PrAssemblyPlanMapper.java
@@ -36,4 +36,6 @@ boolean exists(String name, Long id); List<PrAssemblyPlan> selectAssyPlanList(PrAssemblyPlan params); List<PrAssemblyPlan> selectAssyPlanSimplify(PrAssemblyPlan params); } pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoSta/StaAssemblyWorkLast.java
@@ -6,13 +6,9 @@ import com.baomidou.mybatisplus.annotation.TableName; import com.dy.common.po.BaseEntity; import com.dy.pmsGlobal.pojoBa.BaUser; import com.dy.pmsGlobal.pojoPr.PrProductionNode; import jakarta.validation.Valid; import jakarta.validation.constraints.NotEmpty; import com.dy.pmsGlobal.pojoPr.PrAssemblyPlan; import jakarta.validation.constraints.NotNull; import lombok.*; import java.util.Date; import java.util.List; @@ -90,6 +86,9 @@ @TableField(exist = false) public String nodeName; @TableField(exist = false) public PrAssemblyPlan plan; /** * 任务认领时间 */ pms-parent/pms-global/src/main/resources/mapper/PrAssemblyPlanMapper.xml
@@ -30,6 +30,24 @@ select="com.dy.pmsGlobal.daoPr.PrProductionProcessMapper.selectByPrimaryKey" fetchType="eager" column="process_id" /> </resultMap> <resultMap id="PlanResultMap" type="com.dy.pmsGlobal.pojoPr.PrAssemblyPlan"> <id property="id" column="id" jdbcType="BIGINT"/> <result property="proId" column="pro_id" jdbcType="BIGINT"/> <result property="batchId" column="batch_id" jdbcType="BIGINT"/> <result property="processId" column="process_id" jdbcType="BIGINT"/> <result property="name" column="name" jdbcType="VARCHAR"/> <result property="number" column="number" jdbcType="INTEGER"/> <result property="status" column="status" jdbcType="TINYINT"/> <result property="creator" column="creator" jdbcType="VARCHAR"/> <result property="dt" column="dt" jdbcType="TIMESTAMP"/> <result property="startDate" column="start_date" jdbcType="VARCHAR"/> <result property="endDate" column="end_date" jdbcType="VARCHAR"/> <result property="deleted" column="deleted" jdbcType="TINYINT"/> <result property="content" column="content" jdbcType="VARCHAR"/> <collection property="process" ofType="com.dy.pmsGlobal.pojoPr.PrProductionProcess" select="com.dy.pmsGlobal.daoPr.PrProductionProcessMapper.selectByProcessId" fetchType="eager" column="process_id" /> </resultMap> <sql id="Base_Column_List"> id,pro_id,batch_id, process_id,name,number, @@ -65,6 +83,50 @@ from pr_production_node where process_id = #{processId,jdbcType=BIGINT} </select> <select id="selectAssyPlanSimplify" resultMap="PlanResultMap" parameterType="com.dy.pmsGlobal.pojoPr.PrAssemblyPlan"> select <include refid="Base_Column_List" /> from pr_assembly_plan <trim prefix="where" suffixOverrides="and"> <if test="proId != null"> pro_id = #{proId,jdbcType=BIGINT} and </if> <if test="batchId != null"> batch_id = #{batchId,jdbcType=BIGINT} and </if> <if test="processId != null"> process_id = #{processId,jdbcType=BIGINT} and </if> <if test="name != null"> name = #{name,jdbcType=VARCHAR} and </if> <if test="number != null"> number = #{number,jdbcType=INTEGER} and </if> <if test="status != null"> status = #{status,jdbcType=TINYINT} and </if> <if test="creator != null"> creator = #{creator,jdbcType=VARCHAR} and </if> <if test="dt != null"> dt = #{dt,jdbcType=TIMESTAMP} and </if> <if test="startDate != null"> start_date = #{startDate,jdbcType=VARCHAR} and </if> <if test="endDate != null"> end_date = #{endDate,jdbcType=VARCHAR} and </if> <if test="deleted != null"> deleted = #{deleted,jdbcType=TINYINT} and </if> <if test="content != null"> content = #{content,jdbcType=VARCHAR} and </if> </trim> order by id desc </select> <select id="selectAssyPlanList" resultMap="BaseResultMap" parameterType="com.dy.pmsGlobal.pojoPr.PrAssemblyPlan"> select <include refid="Base_Column_List" /> pms-parent/pms-global/src/main/resources/mapper/PrProductionProcessMapper.xml
@@ -25,6 +25,19 @@ select="selectByProcess" fetchType="eager" column="id" /> </resultMap> <resultMap id="ProcessResultMap" type="com.dy.pmsGlobal.pojoPr.PrProductionProcess"> <id property="id" column="id" jdbcType="BIGINT"/> <result property="proId" column="pro_id" jdbcType="BIGINT"/> <result property="name" column="name" jdbcType="VARCHAR"/> <result property="creator" column="creator" jdbcType="VARCHAR"/> <result property="dt" column="dt" jdbcType="TIMESTAMP"/> <result property="disabled" column="disabled" jdbcType="TINYINT"/> <result property="deleted" column="deleted" jdbcType="TINYINT"/> <result property="remark" column="remark" jdbcType="VARCHAR"/> <collection property="nodes" ofType="com.dy.pmsGlobal.pojoPr.PrProductionNode" select="selectByProcess" fetchType="eager" column="id" /> </resultMap> <sql id="Base_Column_List"> id,pro_id,name, creator,dt,disabled, @@ -41,6 +54,13 @@ from pr_production_node where process_id = #{processId,jdbcType=BIGINT} </select> <select id="selectByProcessId" parameterType="java.lang.Long" resultMap="ProcessResultMap"> select <include refid="Base_Column_List" /> from pr_production_process where id = #{id,jdbcType=BIGINT} </select> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java
@@ -184,7 +184,7 @@ long workId = Long.parseLong(vo.workId); StaAssemblyWorkLast workLast = assemblyWorkLastDao.selectByPrimaryKey(workId); if (workLast == null) { throw new RuntimeException("工单不存在"); throw new RuntimeException("系统中没有该条登录信息"); } StaDeviceLast preDeviceRecord = deviceLastDao.selectByDeviceNo(vo.deviceNo); StaRepairInfo repairInfo = new StaRepairInfo(); pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java
@@ -1,7 +1,6 @@ package com.dy.pmsStation.workOrder; import com.alibaba.excel.util.StringUtils; import com.dy.common.webUtil.BaseResponseUtils; import com.dy.pmsGlobal.daoBa.BaUserMapper; import com.dy.pmsGlobal.daoOth.OthFileMapper; import com.dy.pmsGlobal.daoPlt.PltStationMapper; @@ -27,7 +26,6 @@ import java.util.Date; import java.util.List; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Collectors; @Slf4j @@ -50,30 +48,37 @@ private OthFileMapper othFileMapper; @Value("${dy.webFile.fmUrl}") private String fmUrl ; @Autowired public void setAssemblyDao(PrAssemblyPlanMapper assemblyDao) { this.assemblyDao = assemblyDao; } @Autowired private void setBaUserDao(BaUserMapper baUserDao){ this.baUserDao = baUserDao; } @Autowired private void setPltStationDao(PltStationMapper pltStationDao){ this.pltStationDao = pltStationDao; } @Autowired private void setStaAssemblyWorkHistoryDao(StaAssemblyWorkHistoryMapper assemblyWorkHistoryDao){ this.assemblyWorkHistoryDao = assemblyWorkHistoryDao; } @Autowired private void setStaAssemblyWorkLastDao(StaAssemblyWorkLastMapper assemblyWorkLastDao){ this.assemblyWorkLastDao = assemblyWorkLastDao; } @Autowired public void setFileOperate(FileOperate fileOperate){ this.fileOperate = fileOperate; } @Autowired public void setOthFileMapper(OthFileMapper othFileMapper){ this.othFileMapper = othFileMapper; @@ -98,6 +103,7 @@ } return userInfo; } public PltStation getStationInfo(String id){ //仅检查工站信息以及工站占用情况 Long stationId = null; @@ -118,6 +124,7 @@ } return stationInfo; } public StaAssemblyWorkLast checkStationUsed(String id){ StaAssemblyWorkLast result = new StaAssemblyWorkLast(); PltStation stationInfo = null; @@ -188,22 +195,22 @@ } return result; } @Transactional public StaAssemblyWorkLast save(QueryVo vo) { //先check StaAssemblyWorkLast checkResult = checkUserAndStationUsed(vo); //校验planId processId nodeId PrAssemblyPlan params = new PrAssemblyPlan(); params.setStatus(STATUS_NORMAL); params.setId(vo.getPlanId()); params.setProcessId(vo.getProcessId()); List<PrAssemblyPlan> planList = selectAssyPlanList(params); boolean hasNodeId= planList.stream() .flatMap(process -> process.getProcess().getNodes().stream()) PrAssemblyPlan assyPlan = assemblyDao.selectByPrimaryKey(vo.getPlanId()); if(assyPlan == null){ throw new RuntimeException("组装任务已经在系统中删除请检查,刷新并重新选择任务"); } boolean hasNodeId = assyPlan.getProcess().getNodes().stream() .anyMatch(node -> node.id.equals(vo.getNodeId())); if(!hasNodeId){ throw new RuntimeException("节点信息有误或被其他人员修改,请重新选择节点信息"); } //怎么将只包含这个节点的信息全部回传呢 vo.setLineId(checkResult.getLineId()); StaAssemblyWorkLast staLast = new StaAssemblyWorkLast(); BeanUtils.copyProperties(vo,staLast); @@ -231,8 +238,13 @@ throw new RuntimeException("数据库存储失败"); } StaAssemblyWorkLast result = assemblyWorkLastDao.selectByPrimaryKey(staLast.getId()); List<PrProductionNode> nodeInfo =assyPlan.getProcess().getNodes().stream() .filter(node -> node.id.equals(vo.getNodeId())).collect(Collectors.toList()); assyPlan.getProcess().setNodes(nodeInfo); result.setPlan(assyPlan); return result; } @Transactional public int logout(String id) { //找到登录记录 @@ -252,17 +264,19 @@ assemblyWorkLastDao.deleteByPrimaryKey(Long.parseLong(id)); return count; } public List<PrAssemblyPlan> selectAssyPlanList(PrAssemblyPlan params){ List<PrAssemblyPlan> planList = assemblyDao.selectAssyPlanList(params); planList.stream().forEach(process -> { List<PrAssemblyPlan> planList = assemblyDao.selectAssyPlanSimplify(params); /* planList.stream().forEach(process -> { process.getProcess().getNodes().forEach(node -> { if(node.instruction != null){ addUrl(node.instruction); } }); }); });*/ return planList; } private void addUrl(PrWorkingInstruction ins){ if (ins == null || ins.fileId == null) { return; @@ -276,6 +290,7 @@ ins.orgName = file.orgName; ins.extName = file.extName; } //workId assistants 传的是单个的userId 必传参数 public List<BaUser> updateAssistant(QueryVo vo) { //找到workId @@ -326,6 +341,7 @@ int count = assemblyWorkLastDao.updateByPrimaryKey(workLast); return count; } public int removeAssistant(String workId ,String assistant) { //找到workId StaAssemblyWorkLast workLast = assemblyWorkLastDao.selectByPrimaryKey(Long.parseLong(workId)); @@ -349,6 +365,7 @@ int count = assemblyWorkLastDao.updateByPrimaryKey(workLast); return count; } public List<BaUser> getAssistantList(String workId) { //找到workId StaAssemblyWorkLast workLast = assemblyWorkLastDao.selectByPrimaryKey(Long.parseLong(workId)); @@ -358,4 +375,7 @@ List<BaUser> assistantList = baUserDao.selectByAssistants(workLast.getAssistants()); return assistantList; } //根据节点的查出节点作业指导书 // 根据产品查出产品文件 主要技术参数 }