| | |
| | | import com.nanometer.smartlab.util.Constants; |
| | | import com.nanometer.smartlab.util.FacesUtils; |
| | | import com.nanometer.smartlab.util.IDUtils; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.log4j.Logger; |
| | | import org.apache.poi.hssf.usermodel.HSSFRow; |
| | | import org.apache.poi.hssf.usermodel.HSSFSheet; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.faces.context.FacesContext; |
| | | import javax.faces.event.ActionListener; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | |
| | | private String cas; |
| | | private List<SysSupplier> supplierSelectList; |
| | | private List<Type> typeList; |
| | | private String productSn; |
| | | |
| | | public List<Type> getTypeList() { |
| | | if (this.typeList == null) { |
| | |
| | | private Integer type; |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | return type == null?0:type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | |
| | | } |
| | | |
| | | } |
| | | if (valuesList.size() != 6){ |
| | | break; |
| | | } |
| | | System.out.println("value : "+valuesList); |
| | | sysReagent.setName(valuesList.get(0));//试剂名称 |
| | | sysReagent.setProductHome(valuesList.get(1));//厂家 |
| | |
| | | throw new Exception("导入文件格式不正确"); |
| | | }*/ |
| | | |
| | | for (int t = 0; t < totalCells; t++) { |
| | | for (int t = 0; t <= totalCells; t++) { |
| | | //System.out.println(row.getCell(t)); |
| | | String cellInfo=""; |
| | | String groupId = ""; |
| | |
| | | valuesList.add(cellInfo); |
| | | } |
| | | } |
| | | if (valuesList.size() != 13){ |
| | | break; |
| | | } |
| | | |
| | | System.out.println("value : "+valuesList); |
| | | sysReagent.setProductSn(valuesList.get(0));//产品编号 |
| | |
| | | public List<SysReagent> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) { |
| | | List<SysReagent> list = null; |
| | | try { |
| | | int count = sysReagentService.getSysReagentTotalCount(name, cas, supplierId,type); |
| | | int count = sysReagentService.getSysReagentTotalCountNew(name, cas, supplierId,getType(),productSn); |
| | | this.setRowCount(count); |
| | | if (count > 0) { |
| | | list = sysReagentService.getSysReagentList(name, cas, supplierId,type, first, pageSize); |
| | | list = sysReagentService.getSysReagentListNew(name, cas, supplierId,getType(), first, pageSize,productSn); |
| | | } |
| | | selectedList = new ArrayList<> (); |
| | | } catch (Exception e) { |
| | | logger.error(e); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public SysReagent getRowData(String rowKey) { |
| | | Iterator<SysReagent> iterator = this.iterator(); |
| | | if (iterator != null) { |
| | | SysReagent sr = null; |
| | | while (iterator.hasNext()) { |
| | | sr = iterator.next(); |
| | | if (rowKey.equals(sr.getId())) { |
| | | return sr; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | // Iterator<SysReagent> iterator = this.iterator(); |
| | | // if (iterator != null) { |
| | | // SysReagent sr = null; |
| | | // while (iterator.hasNext()) { |
| | | // sr = iterator.next(); |
| | | // if (rowKey.equals(sr.getId())) { |
| | | // return sr; |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | return sysReagentService.getSysReagent(rowKey); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | return dataModel; |
| | | } |
| | | |
| | | public void export2Excel() { |
| | | |
| | | List<Map> list = sysReagentService.selectAll(name, cas, supplierId,getType(), productSn); |
| | | try{ |
| | | boolean isexport = sysReagentService.export2Excel(list,getType()); |
| | | if (isexport){ |
| | | |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | FacesUtils.warn("导出失败"); |
| | | } |
| | | } |
| | | |
| | | public SysReagent getSysReagent() { |
| | |
| | | public void setDangerousFlagSelectList(List<DangerousFlag> dangerousFlagSelectList) { |
| | | this.dangerousFlagSelectList = dangerousFlagSelectList; |
| | | } |
| | | |
| | | public String getProductSn() { |
| | | return productSn; |
| | | } |
| | | |
| | | public void setProductSn(String productSn) { |
| | | this.productSn = productSn; |
| | | } |
| | | |
| | | public void openUpdateSafetyNumDialog() { |
| | | if (this.selectedList == null |
| | | || this.selectedList.size() == 0) { |
| | | FacesUtils.warn("请选择数据。"); |
| | | return; |
| | | } |
| | | if (this.selectedList.size() > 1) { |
| | | FacesUtils.warn("只能选择一个数据进行修改。"); |
| | | return; |
| | | } |
| | | this.sysReagent = this.sysReagentService.getSysReagent(this.selectedList.get(0).getId()); |
| | | if (this.sysReagent.getType() != 1) { |
| | | FacesUtils.warn("只能选择试剂设置安全库存。"); |
| | | return; |
| | | } |
| | | RequestContext.getCurrentInstance().execute("PF('dialog-setSafetynum').show()"); |
| | | } |
| | | |
| | | public void updateSafetyNum(){ |
| | | if (this.sysReagent.getSafetynum() == null) { |
| | | FacesUtils.warn("请输入安全库存。"); |
| | | return; |
| | | } |
| | | sysReagentService.updateSafetyNum(this.sysReagent); |
| | | FacesUtils.warn("修改成功。"); |
| | | RequestContext.getCurrentInstance().execute("PF('dialog-setSafetynum').hide()"); |
| | | |
| | | } |
| | | } |