inspection-server/src/main/java/com/yuanchu/limslaboratory/controller/InspectionController.java
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.yuanchu.limslaboratory.annotation.AuthHandler; import com.yuanchu.limslaboratory.mapper.InstrumentMapper; import com.yuanchu.limslaboratory.mapper.UserMapper; import com.yuanchu.limslaboratory.pojo.Inspection; import com.yuanchu.limslaboratory.pojo.Report; @@ -50,6 +51,9 @@ @Resource UserMapper userMapper; @Resource private InstrumentMapper instrumentMapper; @ApiOperation(value = "查询检验申请单列表") @ApiImplicitParams(value = { @@ -118,7 +122,7 @@ @ApiOperation(value = "新增检验单") @PostMapping("/addInspect") @AuthHandler public Result addInspect(@RequestHeader("token") String token, @Validated @RequestBody InspectionVo inspectionVo) throws Exception { public Result addInspect(@RequestHeader("X-Token") String token, @Validated @RequestBody InspectionVo inspectionVo) throws Exception { Object object = RedisUtil.get(token); Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); return Result.success(inspectionService.addInspect((Integer) unmarshal.get("id"), inspectionVo)); @@ -141,6 +145,11 @@ return Result.success(userMapper.selectUser()); } @ApiOperation(value = "选择检验设备") @GetMapping("/selectEquipment") @AuthHandler public Result selectEquipment(){return Result.success(instrumentMapper.getInstrument());} @ApiOperation(value = "保存检验项目责任人") @ApiImplicitParams(value = { @ApiImplicitParam(name = "id", value = "检验单项目id", dataTypeClass = Integer.class, required = true), @@ -152,6 +161,13 @@ return Result.success(inspectionService.chooseUseProId(id, userProId)); } @ApiOperation("保存设备id") @GetMapping("/chooseEquipment") @AuthHandler public Result chooseEquipment(Integer id,Integer equipmentId){ return Result.success(inspectionService.chooseEquipment(id, equipmentId)); } @ApiOperation(value = "作废检验单") @ApiImplicitParams(value = { @ApiImplicitParam(name = "id", value = "检验单id", dataTypeClass = Integer.class, required = true) inspection-server/src/main/java/com/yuanchu/limslaboratory/service/InspectionService.java
@@ -78,6 +78,12 @@ */ String chooseUseProId(Integer id, Integer userProId); /** * 保存设备 * @param id * @param equipmentId * @return */ boolean chooseEquipment(Integer id, Integer equipmentId); } inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionServiceImpl.java
@@ -2,6 +2,7 @@ import cn.hutool.core.lang.Snowflake; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -286,12 +287,23 @@ return "保存成功!"; } @Override public boolean chooseEquipment(Integer id, Integer equipmentId) { UpdateWrapper<InspectionProduct>inspectionProductUpdateWrapper=new UpdateWrapper<>(); inspectionProductUpdateWrapper.lambda().set(InspectionProduct::getInstrumentId,equipmentId) .eq(InspectionProduct::getId,id); return inspectionProductMapper.update(null,inspectionProductUpdateWrapper)>0; } /*根据样品名称,样品编号,型号规格获取型号id*/ private Integer getSpecificationId(String name, String mcode, String specification) { //获取物料id Material material = materialMapper.selectOne(Wrappers.<Material>query() .eq("name", name) .eq("code", mcode)); if (Objects.isNull(material)){ return null; } //获取规格名称和型号名称 String[] split = specification.split("-"); String stName = split[0]; inspection-server/src/main/resources/mapper/InspectionMapper.xml
@@ -4,7 +4,7 @@ <select id="selectInspectsList" resultType="map"> select i.id, i.code icode, type, i.type type, DATE_FORMAT(`form_time`,'%Y-%m-%d'), supplier, im.code mcode, laboratory-server/src/main/java/com/yuanchu/limslaboratory/mapper/InstrumentMapper.java
@@ -25,4 +25,6 @@ //分配-->选择设备 List<Map<String, Object>> chooseinstum(); List<Instrument> getInstrument(); } laboratory-server/src/main/resources/mapper/ClassifyMapper.xml
@@ -9,5 +9,8 @@ <if test="fatherName!=null and fatherName!=''"> AND father_name = #{fatherName} </if> <if test="sonName!=null and sonName!=''"> and son_name=#{sonName} </if> </select> </mapper> laboratory-server/src/main/resources/mapper/InstrumentMapper.xml
@@ -46,4 +46,7 @@ left join lims_laboratory.classify c on c.id = instrument.classify_id where conditions in(1,5) </select> <select id="getInstrument" resultType="com.yuanchu.limslaboratory.pojo.Instrument"> select id,equipment_name name from instrument where 1=1 and state=1 and conditions=5 </select> </mapper>