| | |
| | | @Lazy |
| | | @Resource |
| | | private OpeUseFlowService opeUseFlowService; |
| | | @Lazy |
| | | @Resource |
| | | private SysWarehouseStatusService sysWarehouseStatusService; |
| | | @Value("${institute.url}") |
| | | String instituteUrl; |
| | | |
| | |
| | | return retJSON.toJSONString(); |
| | | } |
| | | |
| | | // 报送试剂最新信息接口 |
| | | // 报送试剂最新信息接口 只更新试剂状态ope_regeant_status表 0, "领用" 1, "入库" 2, "存入" 3, "报废" -1, "领用待入库" |
| | | @ResponseBody |
| | | @RequestMapping(value = "/synchAllCabinet") |
| | | public String synchAllCabinet(HttpServletRequest request) throws IOException { |
| | |
| | | return retJSON.toJSONString(); |
| | | } |
| | | |
| | | // 报警情况接口(warning) |
| | | // 出入库记录信息接口 更新试剂流向ope_use_flow表 |
| | | // 操作状态 2 领用 |
| | | // 操作状态 4 错误存放 |
| | | // 操作状态 1 错误入库 |
| | | // 操作状态 6 转移 智能柜试剂转移到另一个柜子 |
| | | // 操作状态 5 报废 |
| | | // 操作状态 3 存放 |
| | | // 操作状态 0 入库 |
| | | // 操作状态 11 仓库领用 |
| | | // 操作状态 10 仓库入库 |
| | | @ResponseBody |
| | | @RequestMapping(value = "/cabinetData") |
| | | public String cabinetData(HttpServletRequest request) throws IOException { |
| | | BufferedReader br = request.getReader(); |
| | | String str, data = ""; |
| | | while((str = br.readLine()) != null){ |
| | | data += str; |
| | | } |
| | | JSONObject retJSON = new JSONObject(); |
| | | logger.info("cabinetData" + data); |
| | | String userId = request.getHeader("userId"); |
| | | |
| | | // Body参数 |
| | | JSONObject bodyJSONObject = new JSONObject(); |
| | | bodyJSONObject = JSONObject.parseObject(data); |
| | | |
| | | // 主控条码 |
| | | String controllerCode = bodyJSONObject.getString("controllerCode"); |
| | | |
| | | try { |
| | | // 数据 |
| | | String dataStr = bodyJSONObject.getString("data"); |
| | | JSONArray dataJSONArray = JSONArray.parseArray(dataStr); |
| | | logger.info("dataJSONArray: " + dataJSONArray); |
| | | |
| | | |
| | | if( dataJSONArray.size() !=0 ){ |
| | | interfaceService.cabinetData(dataJSONArray); |
| | | } |
| | | |
| | | retJSON.put("code", ApiStatus.OK.getRetCode()); |
| | | retJSON.put("message", ApiStatus.OK.getRetMsg()); |
| | | } catch (ApiException e) { |
| | | retJSON.put("code", e.getApiStatus().getRetCode()); |
| | | retJSON.put("message", e.getErrorMessage()); |
| | | } catch (Exception e) { |
| | | retJSON.put("code", ApiStatus.SYS_ERR.getRetCode()); |
| | | StackTraceElement[] stackTraceElements = e.getStackTrace(); |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.append(e.toString()); |
| | | for (StackTraceElement stackTraceElement : stackTraceElements) { |
| | | sb.append("\n"); |
| | | sb.append(stackTraceElement.toString()); |
| | | } |
| | | retJSON.put("message", ApiStatus.SYS_ERR.getRetMsg() + "--" + sb.toString()); |
| | | } |
| | | return retJSON.toJSONString(); |
| | | } |
| | | |
| | | // 报警情况接口(warning) 货柜预警接口 |
| | | @ResponseBody |
| | | @RequestMapping(value = "/alarm") |
| | | public String alarm(HttpServletRequest request) throws IOException { |
| | |
| | | return retJSON.toJSONString(); |
| | | } |
| | | |
| | | // 出入库记录信息接口 |
| | | @ResponseBody |
| | | @RequestMapping(value = "/cabinetData") |
| | | public String cabinetData(HttpServletRequest request) throws IOException { |
| | | BufferedReader br = request.getReader(); |
| | | String str, data = ""; |
| | | while((str = br.readLine()) != null){ |
| | | data += str; |
| | | } |
| | | JSONObject retJSON = new JSONObject(); |
| | | logger.info("cabinetData" + data); |
| | | String userId = request.getHeader("userId"); |
| | | |
| | | // Body参数 |
| | | JSONObject bodyJSONObject = new JSONObject(); |
| | | bodyJSONObject = JSONObject.parseObject(data); |
| | | |
| | | // 主控条码 |
| | | String controllerCode = bodyJSONObject.getString("controllerCode"); |
| | | |
| | | try { |
| | | // 数据 |
| | | String dataStr = bodyJSONObject.getString("data"); |
| | | JSONArray dataJSONArray = JSONArray.parseArray(dataStr); |
| | | logger.info("dataJSONArray: " + dataJSONArray); |
| | | |
| | | |
| | | if( dataJSONArray.size() !=0 ){ |
| | | interfaceService.cabinetData(dataJSONArray); |
| | | } |
| | | |
| | | retJSON.put("code", ApiStatus.OK.getRetCode()); |
| | | retJSON.put("message", ApiStatus.OK.getRetMsg()); |
| | | } catch (ApiException e) { |
| | | retJSON.put("code", e.getApiStatus().getRetCode()); |
| | | retJSON.put("message", e.getErrorMessage()); |
| | | } catch (Exception e) { |
| | | retJSON.put("code", ApiStatus.SYS_ERR.getRetCode()); |
| | | StackTraceElement[] stackTraceElements = e.getStackTrace(); |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.append(e.toString()); |
| | | for (StackTraceElement stackTraceElement : stackTraceElements) { |
| | | sb.append("\n"); |
| | | sb.append(stackTraceElement.toString()); |
| | | } |
| | | retJSON.put("message", ApiStatus.SYS_ERR.getRetMsg() + "--" + sb.toString()); |
| | | } |
| | | return retJSON.toJSONString(); |
| | | } |
| | | |
| | | //http://[URL]/smartlab/api/service/containerInfo |
| | | @ResponseBody |
| | |
| | | logger.info("getUserInfo start..."); |
| | | |
| | | List<SysUser> userList = sysUserService.getSysUserInfoList(startTime, endTime); |
| | | List<SysLaboratoryContainer> allLaboratoryContainerList = sysLaboratoryContainerService.getSysLaboratoryContainerList(null,null,null,null,null); |
| | | List<SysLaboratoryContainer> allLaboratoryContainerList = sysLaboratoryContainerService.getSysLaboratoryContainerList(null,null,null,null,null,null,null); |
| | | List<SysWarehouseContainer> allWarehouseContainerList = sysWarehouseContainerService.getSysWarehouseContainerList(null,null,null,null,null); |
| | | |
| | | List<String> containerCodeList = new ArrayList<String>(); |
| | |
| | | (String[])wareContainerCodeList.toArray(new String[0]))); |
| | | |
| | | } |
| | | if(user.getSeeFlag().ordinal() == SeeFlag.MANAGE.ordinal()){ |
| | | if(user.getSeeFlag().ordinal() == SeeFlag.MANAGE.ordinal() |
| | | || user.getSeeFlag().ordinal() == SeeFlag.LEADING.ordinal()){ |
| | | map.put("containerCodeList", containerCodeList); |
| | | } |
| | | } |
| | |
| | | try { |
| | | |
| | | if (inWarehouseInfo.getReagentCode() != null && inWarehouseInfo.getReagentCode().size() > 0) { |
| | | ReagentReceivingDto reagentReceivingDtos = new ReagentReceivingDto(); |
| | | |
| | | for (int i = 0; i < inWarehouseInfo.getReagentCode().size(); i++) { |
| | | String code = inWarehouseInfo.getReagentCode().get(i); |
| | |
| | | if (ors != null) { |
| | | return ResponseModel.getErrInstance("该试剂危化品编码已存在"); |
| | | } |
| | | |
| | | } |
| | | |
| | | //3.入库 |
| | | //3.如果是入智能柜,则该智能柜下需要存在对应的实验室和实验室柜子 |
| | | SysWarehouseContainer sysWarehouseContainer = sysWarehouseContainerService.getSysWarehouseContainer(inWarehouseInfo.getContainerId()); |
| | | if(this.baseMetaService.getBaseMetaKey(sysWarehouseContainer.getType()).equals("200")) { |
| | | reagentReceivingDtos.setReagentCode(inWarehouseInfo.getReagentCode()); |
| | | reagentReceivingDtos.setApplyUserId(inWarehouseInfo.getUser()); |
| | | SysLaboratoryContainer sysLaboratoryContainer = sysLaboratoryContainerService.getSysLaboratoryContainerByContainerCode(sysWarehouseContainer.getContainerCode()); |
| | | if (null != sysLaboratoryContainer){ |
| | | reagentReceivingDtos.setLabId(sysLaboratoryContainer.getLaboratoryId()); |
| | | reagentReceivingDtos.setLabContainerId(sysLaboratoryContainer.getId()); |
| | | }else { |
| | | return ResponseModel.getErrInstance("该仓库货柜为智能柜,但是未创建相同货柜条码的实验室临时存储柜"); |
| | | } |
| | | } |
| | | |
| | | //4.入库 |
| | | sysWarehouseService.putInWarehouse(inWarehouseInfo); |
| | | |
| | | //5.如果是入智能柜,则需再领用到智能柜里 |
| | | if (StringUtils.isNotBlank(reagentReceivingDtos.getLabContainerId())){ |
| | | sysWarehouseService.reagentReceiving(reagentReceivingDtos); |
| | | } |
| | | |
| | | return ResponseModel.getOkInstence("入库成功"); |
| | | } else { |
| | | return ResponseModel.getErrInstance("无试剂条码"); |
| | |
| | | return ResponseModel.getErrInstance(reagentCode+",该试剂在库存中不存在"); |
| | | } |
| | | } |
| | | String number = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()); |
| | | for (String reagentCode : reagentReceiving.getReagentCode()) { |
| | | OpeReagentStatus opeReagentStatus = opeReagentStatusService |
| | | .getOpeReagentStatusByReagentCode(reagentCode); |
| | |
| | | opeUseFlow.setRemainder(opeUseFlowExist.getRemainder()); |
| | | BaseMeta baseMeta = baseMetaService.getBaseMeta("operate_status",String.valueOf(OperateStatus.TRANSFER.getKey()),"转移"); |
| | | opeUseFlow.setOperateState(baseMeta.getId()); |
| | | opeUseFlow.setReceiptNumber(number); |
| | | opeUseFlowService.insertOpeUseFlow(opeUseFlow); |
| | | } |
| | | return ResponseModel.getOkInstence("转移成功"); |
| | |
| | | hazardousWaste.setMedical(new BigDecimal(0)); |
| | | } |
| | | hazardousWaste.setUpdator(hazardousWaste.getCreator()); |
| | | hazardousWaste.setUpdatetime(new Date()); |
| | | // hazardousWaste.setUpdatetime(new Date()); |
| | | hazardousWasteService.insertInfo(hazardousWaste); |
| | | return ResponseModel.getOkInstence("添加成功"); |
| | | }catch (Exception e){ |
| | |
| | | } |
| | | return retJSON.toJSONString(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("/getAllWarehouse") |
| | | public Object getAllWarehouse() { |
| | | try { |
| | | List<Map> res = sysWarehouseService.getAllWarehouse(); |
| | | return ResponseModel.getOkInstence(res); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResponseModel.getErrInstance("系统内部错误"); |
| | | } |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "addWarehouseStatus",method = RequestMethod.POST) |
| | | public Object addWarehouseStatus(@RequestBody SysWarehouseStatus one){ |
| | | try { |
| | | one.setCreateTime(new Date()); |
| | | sysWarehouseStatusService.addOne(one); |
| | | return ResponseModel.getOkInstence("新增成功"); |
| | | } catch (BusinessException e) { |
| | | e.printStackTrace(); |
| | | return ResponseModel.getErrInstance(e.getMessage()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResponseModel.getErrInstance("系统内部错误"); |
| | | } |
| | | } |
| | | } |