kongzy
2024-07-01 47a751cb301d05276ae5d75145d57b2d090fe4e1
src/main/java/com/nanometer/smartlab/controller/LaboratoryStockMngController.java
@@ -52,19 +52,20 @@
    */
   private LazyDataModel<OpeReagentStatus> reagentStoreDataModel;
   private String reagentId;
   private Long reagentId;
   private List<SysReagent> reagentSelectList;
   private List<OpeReagentStatus> selectedStoreList;
   private List<SysLaboratoryContainer> laboratoryContainers;
   private String reagentCode;
   private String labName;
   /**
    * 数据模型
    */
   private String laboratoryId;
   private String laboratoryContainerId;
   private Long laboratoryId;
   private Long laboratoryContainerId;
   /**
    * SpringMenu中初始化
@@ -92,12 +93,12 @@
               List<OpeReagentStatus> list = null;
               System.out.println(reagentId);
               try {
                  int count = opeReagentStatusService.getOpeReagentStatusTotalCountForLab(reagentId, null,
                        ArrivalStatus.LABORATORY.getKey(), reagentCode, getUserId());
                  int count = opeReagentStatusService.getOpeReagentStatusTotalCountForLab(reagentId,null, null,
                        ArrivalStatus.LABORATORY.getKey(), reagentCode, getUserId(),labName);
                  this.setRowCount(count);
                  if (count > 0) {
                     list = opeReagentStatusService.getOpeReagentStatusListForLab(reagentId, null,
                           ArrivalStatus.LABORATORY.getKey(), reagentCode, getUserId(), first, pageSize);
                     list = opeReagentStatusService.getOpeReagentStatusListForLab(reagentId,null, null,
                           ArrivalStatus.LABORATORY.getKey(), reagentCode, getUserId(),labName, first, pageSize);
                  }
               } catch (Exception e) {
                  logger.error(e);
@@ -107,17 +108,17 @@
            @Override
            public OpeReagentStatus getRowData(String rowKey) {
               Iterator<OpeReagentStatus> iterator = this.iterator();
               if (iterator != null) {
                  OpeReagentStatus su = null;
                  while (iterator.hasNext()) {
                     su = iterator.next();
                     if (rowKey.equals(su.getId())) {
                        return su;
                     }
                  }
               }
               return null;
//               Iterator<OpeReagentStatus> iterator = this.iterator();
//               if (iterator != null) {
//                  OpeReagentStatus su = null;
//                  while (iterator.hasNext()) {
//                     su = iterator.next();
//                     if (rowKey.equals(su.getId())) {
//                        return su;
//                     }
//                  }
//               }
               return  null;
            }
         };
      }
@@ -143,26 +144,41 @@
               } catch (Exception e) {
                  logger.error(e);
               }
               selectedStoreList = null;
               return list;
            }
            @Override
            public OpeReagentStatus getRowData(String rowKey) {
               Iterator<OpeReagentStatus> iterator = this.iterator();
               if (iterator != null) {
                  OpeReagentStatus su = null;
                  while (iterator.hasNext()) {
                     su = iterator.next();
                     if (rowKey.equals(su.getId())) {
                        return su;
                     }
                  }
               }
               return null;
//               Iterator<OpeReagentStatus> iterator = this.iterator();
//               if (iterator != null) {
//                  OpeReagentStatus su = null;
//                  while (iterator.hasNext()) {
//                     su = iterator.next();
//                     if (rowKey.equals(su.getId())) {
//                        return su;
//                     }
//                  }
//               }
               Long id=Long.valueOf(rowKey);
               return opeReagentStatusService.getOpeReagentStatusById(id);
            }
         };
      }
      return reagentStoreDataModel;
   }
   public void exportLabStock() {
      try {
         List<Map> list = opeReagentStatusService.selectExportList(null, null,
               ArrivalStatus.LABORATORY.getKey(), reagentCode, getUserId(),labName);
         opeReagentStatusService.exportLabStock2Excel(list);
         FacesUtils.info("导出成功");
      }catch (Exception e){
         e.printStackTrace();
         FacesUtils.warn("导出失败");
      }
   }
   public int getAction() {
@@ -180,11 +196,11 @@
      this.reagentSelectList = reagentSelectList;
   }
   public String getReagentId() {
   public Long getReagentId() {
      return reagentId;
   }
   public void setReagentId(String reagentId) {
   public void setReagentId(Long reagentId) {
      this.reagentId = reagentId;
   }
@@ -196,19 +212,19 @@
      this.reagentCode = reagentCode;
   }
   public String getLaboratoryId() {
   public Long getLaboratoryId() {
      return laboratoryId;
   }
   public void setLaboratoryId(String laboratoryId) {
   public void setLaboratoryId(Long laboratoryId) {
      this.laboratoryId = laboratoryId;
   }
   public String getLaboratoryContainerId() {
   public Long getLaboratoryContainerId() {
      return laboratoryContainerId;
   }
   public void setLaboratoryContainerId(String laboratoryContainerId) {
   public void setLaboratoryContainerId(Long laboratoryContainerId) {
      this.laboratoryContainerId = laboratoryContainerId;
   }
@@ -221,11 +237,11 @@
   // 是试剂柜入库,还是错误入库
   // 暂定是试剂柜入库
   public void onSaveBtnClick() {
      if (StringUtils.isBlank(laboratoryId)) {
      if (laboratoryId==null) {
         FacesUtils.warn("请选择实验室。");
         return;
      }
      if (StringUtils.isBlank(laboratoryContainerId)) {
      if (laboratoryContainerId==null) {
         FacesUtils.warn("请选择临时存储库。");
         return;
      }
@@ -235,7 +251,7 @@
      }
      for (OpeReagentStatus opeReagentStatus : selectedStoreList) {
         if (opeReagentStatus.getStatus().getKey() != ArrivalStatus.PERSONAL.getKey()) {
         if (opeReagentStatus.getStatus() != ArrivalStatus.PERSONAL.getKey()) {
            FacesUtils.warn("只能存放个人领用中的试剂。");
            return;
         }
@@ -270,4 +286,11 @@
      this.laboratoryContainers = laboratoryContainers;
   }
   public String getLabName() {
      return labName;
   }
   public void setLabName(String labName) {
      this.labName = labName;
   }
}