| | |
| | | import com.dy.pmsGlobal.dyFile.FileRestVo; |
| | | import com.dy.pmsGlobal.pojoBa.BaUser; |
| | | import com.dy.pmsGlobal.pojoOth.OthFile; |
| | | import com.dy.pmsGlobal.pojoPlt.PltProductionLine; |
| | | import com.dy.pmsGlobal.pojoPlt.PltStation; |
| | | import com.dy.pmsGlobal.pojoPr.PrAssemblyPlan; |
| | | import com.dy.pmsGlobal.pojoPr.PrWorkingInstruction; |
| | | 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; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | ins.orgName = file.orgName; |
| | | ins.extName = file.extName; |
| | | } |
| | | |
| | | } |
| | | @Transactional |
| | | public int save(QueryVo last) { |
| | | //先check |
| | | PltStation stationInfo = null; |
| | | BaUser userInfo = null; |
| | | //工站103 |
| | | if(last.getStationId().startsWith("103")){ |
| | | stationInfo = getStationInfo(last.getStationId()); |
| | | }else{ |
| | | userInfo = getUserInfo(last.getStationId()); |
| | | } |
| | | if(last.getUserId().startsWith("103")){ |
| | | stationInfo = getStationInfo(last.getUserId()); |
| | | }else{ |
| | | userInfo = getUserInfo(last.getUserId()); |
| | | } |
| | | if(userInfo == null && stationInfo == null){ |
| | | throw new RuntimeException("员工编码:"+ last.getUserId() + "和工站编码:" + last.getStationId() + "不正确,请检查"); |
| | | }else if(userInfo == null){ |
| | | throw new RuntimeException("员工编码:"+ last.getUserId() + "不正确,请检查"); |
| | | }else if(stationInfo == null){ |
| | | throw new RuntimeException("工站编码:" + last.getStationId() + "不正确,请检查"); |
| | | } |
| | | //校验planId processId nodeId |
| | | PrAssemblyPlan params = new PrAssemblyPlan(); |
| | | params.setStatus(1); |
| | | params.setId(last.getPlanId()); |
| | | params.setProcessId(last.getProcessId()); |
| | | List<PrAssemblyPlan> list = selectAssyPlanList(params); |
| | | list.stream().filter(process -> { |
| | | process.nodes.stream().filter(node -> node.id == last.getNodeId()); |
| | | return false; |
| | | }); |
| | | last.setLineId(stationInfo.getLineId()); |
| | | StaAssemblyWorkLast staLast = new StaAssemblyWorkLast(); |
| | | BeanUtils.copyProperties(last,staLast); |
| | | staLast.setUserId(userInfo.getId()); |
| | | staLast.setStationId(stationInfo.getId()); |
| | | int count = assemblyWorkLastDao.insertSelective(staLast); |
| | | return count; |
| | | } |
| | | } |