| | |
| | | import com.nanometer.smartlab.dao.OpeWarehouseReserveDao; |
| | | import com.nanometer.smartlab.entity.*; |
| | | import com.nanometer.smartlab.entity.dto.ApplyListDto; |
| | | import com.nanometer.smartlab.entity.enumtype.ApplyStatusVo; |
| | | import com.nanometer.smartlab.entity.enumtype.ApplyStatus; |
| | | import com.nanometer.smartlab.entity.enumtype.ArrivalStatus; |
| | | import com.nanometer.smartlab.entity.enumtype.SeeFlag; |
| | | import com.nanometer.smartlab.entity.enumtype.ValidFlag; |
| | | import com.nanometer.smartlab.exception.BusinessException; |
| | | import com.nanometer.smartlab.exception.ExceptionEnumCode; |
| | | import com.nanometer.smartlab.service.*; |
| | | import com.nanometer.smartlab.util.*; |
| | | import org.apache.commons.lang.StringUtils; |
| | |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.primefaces.context.RequestContext; |
| | | import org.primefaces.event.SelectEvent; |
| | | import org.primefaces.event.TabChangeEvent; |
| | | import org.primefaces.model.LazyDataModel; |
| | | import org.primefaces.model.SortOrder; |
| | | import org.primefaces.model.StreamedContent; |
| | |
| | | import org.springframework.context.annotation.PropertySource; |
| | | import org.springframework.context.annotation.Scope; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.faces.context.ExternalContext; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.net.URLEncoder; |
| | | import java.sql.Timestamp; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | import java.util.stream.Collectors; |
| | |
| | | private SysUserService sysUserService; |
| | | @Resource |
| | | private SysSupplierService sysSupplierService; |
| | | @Resource |
| | | private OpeOrderService opeOrderService; |
| | | |
| | | @Resource |
| | | private MenuController menuController; |
| | |
| | | |
| | | @Resource(name = "opeReagentStatusDao") |
| | | OpeReagentStatusDao opeReagentStatusDao; |
| | | @Resource |
| | | OpeUseFlowService opeUseFlowService; |
| | | |
| | | @Resource |
| | | OpeWarehouseReserveDao opeWarehouseReserveDao; |
| | |
| | | private String reagentLogId; |
| | | |
| | | private String userName; |
| | | private Integer tabValue = 0; |
| | | |
| | | private List<SysReagent> reagentSelectList; |
| | | private List<String> showCodes; |
| | |
| | | private OpeApply reagentDStore; |
| | | private String applyNewReagentName; |
| | | private String applyNewCas; |
| | | private String productSn; |
| | | private String applyCode; |
| | | private Integer status; |
| | | private List<ApplyStatusVo> statusSelectList; |
| | | |
| | | private List<SysWarehouse> warehouseList; |
| | | private List<SysWarehouseContainer> warehouseContainerList; |
| | |
| | | private List<OpeApplyReserve> selectedListForPerson; |
| | | private List<OpeApplyReserve> selectedTmpOrderList; |
| | | private List<OpeApplyReserve> trulySelectedOrderList; |
| | | |
| | | /** |
| | | * 入库车 |
| | | */ |
| | | private List<OpeApplyReserve> selectedInputStorageTmpOrderList; |
| | | private List<OpeApplyReserve> trulyInputStorageTmpSelectedOrderList; |
| | | /** |
| | | * 订单入库变量 |
| | | */ |
| | | //到货时间 |
| | | private Timestamp arrivalTime; |
| | | //收货人 |
| | | private String consigneeId; |
| | | //OpeApply |
| | | private List<OpeApplyReserve> opeApplyList; |
| | | /** |
| | | * 条形码对话框中选择的条形码集合 |
| | | */ |
| | |
| | | } |
| | | |
| | | this.onWarehouseSelectChange(null); |
| | | } |
| | | |
| | | public void initInputWarehouse() { |
| | | logger.info("WarehouseStockMngController initInputWarehouse start"); |
| | | this.warehouseList = this.sysWarehouseService.getSysWarehouseList(null, null, null, null); |
| | | this.warehouseNameMap = new HashMap<String, String>(); |
| | | if (this.warehouseList != null && this.warehouseList.size() > 0) { |
| | | for (SysWarehouse house : this.warehouseList) { |
| | | this.warehouseNameMap.put(house.getId(), house.getName()); |
| | | } |
| | | } |
| | | this.warehouseContainerMap = new HashMap<String, SysWarehouseContainer>(); |
| | | this.warehouseIdContainerMap = new HashMap<String, List<SysWarehouseContainer>>(); |
| | | List<SysWarehouseContainer> warehouseContainerList = this.sysWarehouseContainerService.getSysWarehouseContainerList(null, null, null, null, null); |
| | | if (warehouseContainerList != null && warehouseContainerList.size() > 0) { |
| | | for (SysWarehouseContainer container : warehouseContainerList) { |
| | | warehouseContainerMap.put(container.getId(), container); |
| | | |
| | | if (!warehouseIdContainerMap.containsKey(container.getWarehouseId()) |
| | | || warehouseIdContainerMap.get(container.getWarehouseId()) == null) { |
| | | warehouseIdContainerMap.put(container.getWarehouseId(), new ArrayList<SysWarehouseContainer>()); |
| | | } |
| | | warehouseIdContainerMap.get(container.getWarehouseId()).add(container); |
| | | } |
| | | } |
| | | |
| | | this.onWarehouseSelectChange(null); |
| | | } |
| | | |
| | | private void initReagentSelectList() { |
| | |
| | | } |
| | | } |
| | | |
| | | public void addInputStorageOrder() { |
| | | if (this.selectedListForPerson == null || this.selectedListForPerson.size() == 0) { |
| | | FacesUtils.warn("请选择数据。"); |
| | | return; |
| | | } |
| | | //1.判断非状态为确认的申购单不能入库 |
| | | for (OpeApplyReserve opeApplyReserve : this.selectedListForPerson) { |
| | | if (opeApplyReserve.getStatus() != ApplyStatus.SUPPLIER_CONFIRM) { |
| | | FacesUtils.warn("非已确认的数据不能入库。"); |
| | | return; |
| | | } |
| | | } |
| | | //2.加入暂存 |
| | | if (selectedInputStorageTmpOrderList !=null && selectedInputStorageTmpOrderList.size()>0){ |
| | | ArrayList<OpeApplyReserve> tmp = new ArrayList<>(); |
| | | selectedListForPerson.forEach(opeApplyReserve -> { |
| | | AtomicBoolean flag = new AtomicBoolean(false); |
| | | selectedInputStorageTmpOrderList.forEach(opeApplyReserve1 -> { |
| | | if (opeApplyReserve.getId().equals(opeApplyReserve1.getId())){ |
| | | flag.set(true); |
| | | } |
| | | |
| | | }); |
| | | if(!flag.get()) { |
| | | tmp.add(opeApplyReserve); |
| | | } |
| | | }); |
| | | selectedInputStorageTmpOrderList.addAll(tmp); |
| | | }else{ |
| | | selectedInputStorageTmpOrderList = new ArrayList<>(); |
| | | selectedInputStorageTmpOrderList.addAll(selectedListForPerson); |
| | | } |
| | | } |
| | | |
| | | |
| | | public void clear(){ |
| | | selectedTmpList = null; |
| | |
| | | |
| | | public void clearOrderTmp(){ |
| | | selectedTmpOrderList = null; |
| | | } |
| | | |
| | | public void clearInputStorageTmp(){ |
| | | selectedInputStorageTmpOrderList = null; |
| | | } |
| | | |
| | | public void cancel(){ |
| | |
| | | return; |
| | | } |
| | | |
| | | ArrayList<Integer> indexs = new ArrayList<>(); |
| | | for (int i =0;i<trulySelectedList.size();i++){ |
| | | for (int j = 0; j < selectedTmpList.size(); j++) { |
| | | if(trulySelectedList.get(i).getId().equals(selectedTmpList.get(j).getId())) |
| | | { |
| | | indexs.add(i); |
| | | } |
| | | } |
| | | } |
| | | ArrayList<Object> indexs = new ArrayList<>(); |
| | | for (OpeWarehouseReserve warehouseReserve : trulySelectedList) { |
| | | for (OpeWarehouseReserve opeWarehouseReserve : selectedTmpList) { |
| | | if (warehouseReserve.getId().equals(opeWarehouseReserve.getId())) { |
| | | indexs.add(warehouseReserve); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (indexs.size()>0){ |
| | | indexs.forEach(index -> { |
| | | selectedTmpList.remove(selectedTmpList.get(index)); |
| | | indexs.forEach(obj -> { |
| | | selectedTmpList.remove(obj); |
| | | }); |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | ArrayList<Integer> indexs = new ArrayList<>(); |
| | | for (int i =0;i<trulySelectedOrderList.size();i++){ |
| | | for (int j = 0; j < selectedTmpOrderList.size(); j++) { |
| | | if(trulySelectedOrderList.get(i).getId().equals(selectedTmpOrderList.get(j).getId())) |
| | | { |
| | | indexs.add(i); |
| | | ArrayList<Object> indexs = new ArrayList<>(); |
| | | for (OpeApplyReserve opeApplyReserve : trulySelectedOrderList) { |
| | | for (OpeApplyReserve applyReserve : selectedTmpOrderList) { |
| | | if (opeApplyReserve.getId().equals(applyReserve.getId())) { |
| | | indexs.add(opeApplyReserve); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (indexs.size()>0){ |
| | | indexs.forEach(obj -> { |
| | | selectedTmpOrderList.remove(obj); |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | public void cancelInputStorageTmp(){ |
| | | if (trulyInputStorageTmpSelectedOrderList == null || trulyInputStorageTmpSelectedOrderList.size()<=0){ |
| | | FacesUtils.info("至少选择一个"); |
| | | return; |
| | | } |
| | | |
| | | if (selectedInputStorageTmpOrderList == null || selectedInputStorageTmpOrderList.size()<=0){ |
| | | FacesUtils.info("至少选择一个"); |
| | | return; |
| | | } |
| | | |
| | | ArrayList<Object> indexs = new ArrayList<>(); |
| | | for (OpeApplyReserve opeApplyReserve : trulyInputStorageTmpSelectedOrderList) { |
| | | for (OpeApplyReserve applyReserve : selectedInputStorageTmpOrderList) { |
| | | if (opeApplyReserve.getId().equals(applyReserve.getId())) { |
| | | indexs.add(opeApplyReserve); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (indexs.size()>0){ |
| | | indexs.forEach(index -> { |
| | | selectedTmpOrderList.remove(selectedTmpOrderList.get(index)); |
| | | indexs.forEach(obj -> { |
| | | selectedInputStorageTmpOrderList.remove(obj); |
| | | }); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | this.menuController.goToPage(Constants.PAGE_WAREHOUSE_REAGENT_USE_NEW_PERSON, Constants.PAGE_WAREHOUSE_STOCK_MNG); |
| | | } |
| | | |
| | | public void onUseBtnClickInputStorageTmp(){ |
| | | if (selectedInputStorageTmpOrderList == null || selectedInputStorageTmpOrderList.size()<=0){ |
| | | FacesUtils.info("至少选择一个"); |
| | | return; |
| | | } |
| | | opeApplyList = new ArrayList<>(); |
| | | selectedInputStorageTmpOrderList.forEach(opeApplyReserve -> { |
| | | OpeApplyReserve applyDetail = opeApplyService.getOpeApplyDetail(opeApplyReserve.getId()); |
| | | opeApplyList.add(applyDetail); |
| | | |
| | | }); |
| | | //跳转编辑页面 |
| | | this.menuController.goToPage(Constants.PAGE_ORDER_INPUT_WAREHOUSE, Constants.PAGE_WAREHOUSE_STOCK_MNG); |
| | | } |
| | | |
| | | public void onUseBtnClickForPerson() { |
| | |
| | | } |
| | | } |
| | | // 将当前选择条形码保存到库存中 |
| | | for (OpeApplyReserve opeApplyReserve : this.selectedListForPerson) { |
| | | for (OpeApplyReserve opeApplyReserve : this.selectedTmpOrderList) { |
| | | if (opeApplyReserve.getId().equals(this.selectedOpeApplyReserve.getId())) { |
| | | OpeWarehouseReserve wa=opeWarehouseReserveService.getOpeWarehouseReserve(opeApplyReserve.getReagent().getId(),opeApplyReserve.getArticleNumber()); |
| | | if(this.useNum > wa.getReserve()) |
| | |
| | | List<String> codeList=new ArrayList<>(); |
| | | for (OpeApplyReserve opeApplyReserve : this.selectedTmpOrderList) { |
| | | if (opeApplyReserve.getId().equals(this.selectedOpeApplyReserve.getId())) { |
| | | OpeWarehouseReserve wa=opeWarehouseReserveService.getOpeWarehouseReserve(opeApplyReserve.getReagent().getId(),opeApplyReserve.getArticleNumber()); |
| | | if(wa==null){ |
| | | wa=new OpeWarehouseReserve(); |
| | | wa.setReserve(0); |
| | | } |
| | | if(this.useNum > wa.getReserve()) |
| | | { |
| | | FacesUtils.warn("库存不够,请确认或申购!"); |
| | | // OpeWarehouseReserve wa=opeWarehouseReserveService.getOpeWarehouseReserve(opeApplyReserve.getReagent().getId(),opeApplyReserve.getArticleNumber()); |
| | | // if(wa==null){ |
| | | // wa=new OpeWarehouseReserve(); |
| | | // wa.setReserve(0); |
| | | // } |
| | | // if(this.useNum > wa.getReserve()) |
| | | // { |
| | | // FacesUtils.warn("库存不够,请确认或申购!"); |
| | | // return; |
| | | // } |
| | | if (this.useNum+opeApplyReserve.getUsed() > opeApplyReserve.getNum()){ |
| | | FacesUtils.warn("领用数量超出申请数量!"); |
| | | return; |
| | | } |
| | | opeApplyReserve.setSelectNum(useNum); |
| | |
| | | |
| | | System.out.println("====onYesBtnClick======"); |
| | | // 将当前选择条形码保存到库存中 |
| | | for (OpeWarehouseReserve opeWarehouseReserve : this.selectedList) { |
| | | for (OpeWarehouseReserve opeWarehouseReserve : this.selectedTmpList) { |
| | | if (opeWarehouseReserve.getId().equals(this.selectedOpeWarehouseReserve.getId())) { |
| | | if(this.useNum > opeWarehouseReserve.getReserve()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | public void onTabChange(TabChangeEvent event) { |
| | | if ("firstTab".equals(event.getTab().getId())) { |
| | | tabValue = 0; |
| | | }else{ |
| | | tabValue = 1; |
| | | } |
| | | } |
| | | |
| | | |
| | | public void onCancelBtnClick() { |
| | | this.selectedTmpOrderList = null; |
| | | this.selectedTmpList = null; |
| | | this.selectedInputStorageTmpOrderList = null; |
| | | this.menuController.backToPage(); |
| | | } |
| | | |
| | | public void onClose(){ |
| | | this.selectedTmpOrderList = null; |
| | | this.selectedTmpList = null; |
| | | this.menuController.backToPage(); |
| | | } |
| | |
| | | |
| | | public void onSaveBtnClickForPerson(){ |
| | | try { |
| | | if (this.selectedListForPerson == null || this.selectedListForPerson.size() == 0) { |
| | | if (this.selectedTmpOrderList == null || this.selectedTmpOrderList.size() == 0) { |
| | | FacesUtils.warn("请选择申领试剂。"); |
| | | return; |
| | | } |
| | |
| | | List<OpeApplyReserve> list=new ArrayList<>(); |
| | | List<OpeApplyReserve> list2=new ArrayList<>(); |
| | | //int size = 0; |
| | | for(OpeApplyReserve app:this.selectedListForPerson){ |
| | | for(OpeApplyReserve app:this.selectedTmpOrderList){ |
| | | if(app.getFlag()==1){ |
| | | list.add(app); |
| | | }else { |
| | |
| | | } |
| | | public void onSaveBtnClick() { |
| | | try { |
| | | if (this.selectedList == null || this.selectedList.size() == 0) { |
| | | if (this.selectedTmpList == null || this.selectedTmpList.size() == 0) { |
| | | FacesUtils.warn("请选择申领试剂。"); |
| | | return; |
| | | } |
| | |
| | | int sum = 0; |
| | | List<OpeWarehouseReserve> list=new ArrayList<>(); |
| | | List<OpeWarehouseReserve> list2=new ArrayList<>(); |
| | | for (OpeWarehouseReserve selectWarehouseReserve : this.selectedList) { |
| | | for (OpeWarehouseReserve selectWarehouseReserve : this.selectedTmpList) { |
| | | if(selectWarehouseReserve.getFlag()==1){ |
| | | list.add(selectWarehouseReserve); |
| | | }else{ |
| | |
| | | FacesUtils.warn("操作失败。"); |
| | | } |
| | | } |
| | | /** |
| | | * @Description: 订单入库保存 |
| | | */ |
| | | public void onSaveInputWarehouseClick(){ |
| | | try{ |
| | | //用来检验提交表单得试剂条码是否重复 |
| | | Map<String,Boolean> checkTable= new HashMap<>(); |
| | | if (opeApplyList != null && opeApplyList.size() > 0) { |
| | | for (OpeApplyReserve opeApplyReserve:opeApplyList) { |
| | | //0.1获取该申购单的订单 |
| | | OpeOrder oo = opeOrderService.getOrder(opeApplyReserve.getId()); |
| | | if (oo == null) { |
| | | throw new BusinessException(ExceptionEnumCode.ORDER_ERROR,"订单不存在"); |
| | | } |
| | | //0.2检查条码->得到试剂条码列表 |
| | | List<String> codeList = opeReagentStatusService |
| | | .checkReagentCode(opeApplyReserve.getStartReagentCode2(), opeApplyReserve.getEndReagentCode2(), opeApplyReserve.getArrivalNum()); |
| | | if (codeList != null && codeList.size() > 0) { |
| | | for (String code:codeList) { |
| | | if (checkTable.get(code) == null) { |
| | | checkTable.put(code, true); |
| | | }else{ |
| | | throw new BusinessException(ExceptionEnumCode.PARAM_EXIST, "当前订单条码重复,"+code); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | checkTable = null; |
| | | opeApplyService.orderInputWarehouse(opeApplyList,consigneeId,arrivalTime); |
| | | } |
| | | |
| | | FacesUtils.info("入库完成"); |
| | | //返回 |
| | | this.onCancelBtnClick(); |
| | | }catch (BusinessException e){ |
| | | e.printStackTrace(); |
| | | FacesUtils.warn(e.getMessage()); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | FacesUtils.warn("系统异常,操作失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | @SuppressWarnings("serial") |
| | | public LazyDataModel<OpeWarehouseReserve> getDataModel() { |
| | |
| | | Map<String, Object> filters) { |
| | | List<OpeWarehouseReserve> list = null; |
| | | try { |
| | | int count = opeWarehouseReserveService.getOpeWarehouseReserveTotalCountByName(reagentId, supplierId); |
| | | int count = opeWarehouseReserveService.getOpeWarehouseReserveTotalCountByName(reagentId, supplierId,productSn); |
| | | this.setRowCount(count); |
| | | if (count > 0) { |
| | | list = opeWarehouseReserveService.getOpeWarehouseReserveListByName(reagentId, supplierId, first, |
| | | pageSize); |
| | | pageSize,productSn); |
| | | } |
| | | } catch (Exception e) { |
| | | logger.error(e); |
| | |
| | | } |
| | | |
| | | try { |
| | | |
| | | int count = opeApplyService.getOpeApplyReserveTotalCountByNameFor(id,reagentId, userName); |
| | | int count = opeApplyService.getOpeApplyReserveTotalCountByNameFor(id,reagentId, userName,productSn,applyCode,status); |
| | | this.setRowCount(count); |
| | | if (count > 0) { |
| | | list = opeApplyService.getOpeApplyReserveListByNameFor(id,reagentId, userName, first, |
| | | pageSize); |
| | | pageSize,productSn,applyCode,status); |
| | | } |
| | | } catch (Exception e) { |
| | | logger.error(e); |
| | |
| | | } |
| | | return reagentStatusDataModel; |
| | | } |
| | | |
| | | public void onExportFileBtnClickOrder(){ |
| | | ServletOutputStream out = null; |
| | | InputStream is = null; |
| | | try { |
| | | FacesContext ctx = FacesContext.getCurrentInstance(); |
| | | ctx.responseComplete(); |
| | | String contentType = "application/x-download"; |
| | | HttpServletResponse response = (HttpServletResponse) ctx |
| | | .getExternalContext().getResponse(); |
| | | response.setContentType(contentType); |
| | | StringBuffer contentDisposition = new StringBuffer(); |
| | | contentDisposition.append("attachment;"); |
| | | contentDisposition.append("filename=\""); |
| | | contentDisposition.append("订单领取导出.xls"); |
| | | contentDisposition.append("\""); |
| | | response.setHeader( |
| | | "Content-Disposition", |
| | | new String(contentDisposition.toString().getBytes( |
| | | System.getProperty("file.encoding")), "ISO8859-1")); |
| | | out = response.getOutputStream(); |
| | | Map<String, Integer> tempMap = new HashMap<String,Integer>(); |
| | | List<OpeApplyReserve> realDataList = new ArrayList<>(); |
| | | //map=null; |
| | | SysUser loginUser = getUser(); |
| | | String id=""; |
| | | if(loginUser.getSeeFlag()==SeeFlag.MANAGE){ |
| | | |
| | | }else { |
| | | //userName=loginUser.getName(); |
| | | id=loginUser.getId(); |
| | | } |
| | | if(selectedListForPerson!=null&&selectedListForPerson.size()>0){ |
| | | realDataList=selectedListForPerson; |
| | | }else { |
| | | realDataList = opeApplyService.getOpeApplyReserveListByNameFor(id,reagentId, userName, null, |
| | | null,productSn,applyCode,status); |
| | | } |
| | | List<String> headerList = new ArrayList<>(); |
| | | headerList.add("申购编号"); |
| | | headerList.add("产品编号"); |
| | | headerList.add("试剂名称"); |
| | | headerList.add("管制品"); |
| | | headerList.add("规格型号"); |
| | | headerList.add("包装"); |
| | | headerList.add("价格"); |
| | | headerList.add("CAS"); |
| | | headerList.add("危险性质"); |
| | | headerList.add("厂家"); |
| | | headerList.add("申请数量"); |
| | | headerList.add("已领用数量"); |
| | | headerList.add("申领人"); |
| | | headerList.add("订单状态"); |
| | | headerList.add("课题组"); |
| | | headerList.add("课题组负责人"); |
| | | headerList.add("到货时间"); |
| | | HSSFWorkbook hssfWorkbook =exportExcelOrder(headerList, realDataList); |
| | | hssfWorkbook.write(out); |
| | | out.flush(); |
| | | ctx.responseComplete(); |
| | | |
| | | }catch (Exception e) { |
| | | if(is!=null){ |
| | | try { |
| | | is.close(); |
| | | } catch (IOException e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | } |
| | | if(out!=null){ |
| | | try { |
| | | out.close(); |
| | | } catch (IOException e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | } |
| | | e.printStackTrace(); |
| | | }finally { |
| | | if (is != null) { |
| | | try { |
| | | is.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | if (out != null) { |
| | | try { |
| | | out.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public HSSFWorkbook exportExcelOrder(List<String> headerList, List<OpeApplyReserve> dataList){ |
| | | HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); |
| | | Integer total = null; |
| | | HSSFSheet sheet = hssfWorkbook.createSheet("订单领取导出"); |
| | | HSSFRow titlerRow = sheet.createRow(0); |
| | | for(int i = 0; i < headerList.size(); i++) { |
| | | titlerRow.createCell(i).setCellValue(headerList.get(i)); |
| | | } |
| | | for (int i = 0; i < dataList.size(); i++) { |
| | | HSSFRow dataRow = sheet.createRow(i + 1); |
| | | dataRow.createCell(0).setCellValue(dataList.get(i).getApplyCode()== null ? "": String.valueOf(dataList.get(i).getApplyCode())); |
| | | dataRow.createCell(1).setCellValue(dataList.get(i).getReagent().getProductSn()== null ? "": String.valueOf(dataList.get(i).getReagent().getProductSn())); |
| | | dataRow.createCell(2).setCellValue(dataList.get(i).getReagent().getName()== null ? "": String.valueOf(dataList.get(i).getReagent().getName())); |
| | | dataRow.createCell(3).setCellValue(dataList.get(i).getReagent().getControlProducts()== null ? "": String.valueOf(dataList.get(i).getReagent().getControlProducts())); |
| | | dataRow.createCell(4).setCellValue(dataList.get(i).getReagent().getReagentFormat()== null ? "": String.valueOf(dataList.get(i).getReagent().getReagentFormat())); |
| | | dataRow.createCell(5).setCellValue(dataList.get(i).getReagent().getMainMetering()== null ? "": String.valueOf(dataList.get(i).getReagent().getMainMetering())); |
| | | dataRow.createCell(6).setCellValue(dataList.get(i).getReagent().getPrice()== null ? "": String.valueOf(dataList.get(i).getReagent().getPrice())); |
| | | dataRow.createCell(7).setCellValue(dataList.get(i).getReagent().getCas()== null ? "": String.valueOf(dataList.get(i).getReagent().getCas())); |
| | | dataRow.createCell(8).setCellValue(dataList.get(i).getReagent().getReagentCharacter()== null ? "": String.valueOf(dataList.get(i).getReagent().getReagentCharacter())); |
| | | dataRow.createCell(9).setCellValue(dataList.get(i).getReagent().getProductHomeName()== null ? "": String.valueOf(dataList.get(i).getReagent().getProductHomeName())); |
| | | dataRow.createCell(10).setCellValue(dataList.get(i).getNum()== null ? "": String.valueOf(dataList.get(i).getNum())); |
| | | dataRow.createCell(11).setCellValue(dataList.get(i).getUsed()== null ? "": String.valueOf(dataList.get(i).getUsed())); |
| | | dataRow.createCell(12).setCellValue(dataList.get(i).getApplyUserId()== null ? "": String.valueOf(dataList.get(i).getApplyUserId())); |
| | | dataRow.createCell(13).setCellValue(dataList.get(i).getStatus()== null ? "": String.valueOf(dataList.get(i).getStatus().getText())); |
| | | dataRow.createCell(14).setCellValue(dataList.get(i).getProject()== null ? "": String.valueOf(dataList.get(i).getProject())); |
| | | dataRow.createCell(15).setCellValue(dataList.get(i).getProjectManage()== null ? "": String.valueOf(dataList.get(i).getProjectManage())); |
| | | dataRow.createCell(16).setCellValue(dataList.get(i).getArrivalTime()== null ? "": String.valueOf(dataList.get(i).getArrivalTime())); |
| | | } |
| | | return hssfWorkbook; |
| | | } |
| | | |
| | | public void onExportFileBtnClickNew(){ |
| | | ServletOutputStream out = null; |
| | | InputStream is = null; |
| | |
| | | realDataList=selectedList; |
| | | }else { |
| | | realDataList = opeWarehouseReserveService.getOpeWarehouseReserveListByName(reagentId, supplierId, null, |
| | | null); |
| | | null,productSn); |
| | | } |
| | | List<String> headerList = new ArrayList<>(); |
| | | headerList.add("试剂名称"); |
| | | headerList.add("产品编号"); |
| | | headerList.add("cas"); |
| | | headerList.add("厂家"); |
| | | headerList.add("供应商"); |
| | |
| | | |
| | | public HSSFWorkbook exportExcelNew(List<String> headerList, List<OpeWarehouseReserve> dataList) { |
| | | HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); |
| | | |
| | | |
| | | Integer total = null; |
| | | HSSFSheet sheet = hssfWorkbook.createSheet("仓库库存"); |
| | | HSSFRow titlerRow = sheet.createRow(0); |
| | |
| | | for (int i = 0; i < dataList.size(); i++) { |
| | | HSSFRow dataRow = sheet.createRow(i + 1); |
| | | dataRow.createCell(0).setCellValue(dataList.get(i).getReagent().getName()== null ? "": String.valueOf(dataList.get(i).getReagent().getName())); |
| | | dataRow.createCell(1).setCellValue(dataList.get(i).getReagent().getCas()== null ? "": String.valueOf(dataList.get(i).getReagent().getCas())); |
| | | dataRow.createCell(2).setCellValue(dataList.get(i).getReagent().getProductHomeName()== null ? "": String.valueOf(dataList.get(i).getReagent().getProductHomeName())); |
| | | dataRow.createCell(3).setCellValue(dataList.get(i).getReagent().getSupplierName()== null ? "": String.valueOf(dataList.get(i).getReagent().getSupplierName())); |
| | | dataRow.createCell(4).setCellValue(dataList.get(i).getReagent().getReagentFormat()== null ? "": String.valueOf(baseMetaService.getBaseMetaValue(dataList.get(i).getReagent().getReagentFormat()))); |
| | | dataRow.createCell(5).setCellValue(dataList.get(i).getReagent().getMainMetering()== null ? "": String.valueOf(dataList.get(i).getReagent().getMainMetering())+baseMetaService.getBaseMetaValue(dataList.get(i).getReagent().getReagentUnit())); |
| | | dataRow.createCell(6).setCellValue(dataList.get(i).getReagent().getPrice()== null ? "": String.valueOf(dataList.get(i).getReagent().getPrice())); |
| | | dataRow.createCell(7).setCellValue(dataList.get(i).getArticleNumber()== null ? "": String.valueOf(dataList.get(i).getArticleNumber())); |
| | | dataRow.createCell(8).setCellValue(dataList.get(i).getReserve()== null ? "": String.valueOf(dataList.get(i).getReserve())); |
| | | dataRow.createCell(9).setCellValue(dataList.get(i).getWarehouseName()== null ? "": String.valueOf(dataList.get(i).getWarehouseName())); |
| | | dataRow.createCell(1).setCellValue(dataList.get(i).getReagent().getProductSn()== null ? "": String.valueOf(dataList.get(i).getReagent().getProductSn())); |
| | | dataRow.createCell(2).setCellValue(dataList.get(i).getReagent().getCas()== null ? "": String.valueOf(dataList.get(i).getReagent().getCas())); |
| | | dataRow.createCell(3).setCellValue(dataList.get(i).getReagent().getProductHomeName()== null ? "": String.valueOf(dataList.get(i).getReagent().getProductHomeName())); |
| | | dataRow.createCell(4).setCellValue(dataList.get(i).getReagent().getSupplierName()== null ? "": String.valueOf(dataList.get(i).getReagent().getSupplierName())); |
| | | dataRow.createCell(5).setCellValue(dataList.get(i).getReagent().getReagentFormat()== null ? "": String.valueOf(baseMetaService.getBaseMetaValue(dataList.get(i).getReagent().getReagentFormat()))); |
| | | dataRow.createCell(6).setCellValue(dataList.get(i).getReagent().getMainMetering()== null ? "": String.valueOf(dataList.get(i).getReagent().getMainMetering())+baseMetaService.getBaseMetaValue(dataList.get(i).getReagent().getReagentUnit())); |
| | | dataRow.createCell(7).setCellValue(dataList.get(i).getReagent().getPrice()== null ? "": String.valueOf(dataList.get(i).getReagent().getPrice())); |
| | | dataRow.createCell(8).setCellValue(dataList.get(i).getArticleNumber()== null ? "": String.valueOf(dataList.get(i).getArticleNumber())); |
| | | dataRow.createCell(9).setCellValue(dataList.get(i).getReserve()== null ? "": String.valueOf(dataList.get(i).getReserve())); |
| | | dataRow.createCell(10).setCellValue(dataList.get(i).getWarehouseName()== null ? "": String.valueOf(dataList.get(i).getWarehouseName())); |
| | | |
| | | } |
| | | return hssfWorkbook; |
| | |
| | | public List<SysReagent> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) { |
| | | List<SysReagent> list = null; |
| | | try { |
| | | int count = sysReagentService.getSysReagentTotalCountNew(applyNewReagentName, applyNewCas, null,null); |
| | | int count = sysReagentService.getSysReagentTotalCountNew(applyNewReagentName, applyNewCas, null,null,productSn); |
| | | this.setRowCount(count); |
| | | if (count > 0) { |
| | | list = sysReagentService.getSysReagentListNew(applyNewReagentName, applyNewCas, null,null, first, pageSize); |
| | | list = sysReagentService.getSysReagentListNew(applyNewReagentName, applyNewCas, null,null, first, pageSize,productSn); |
| | | } |
| | | } catch (Exception e) { |
| | | logger.error(e); |
| | |
| | | public void setTrulySelectedOrderList(List<OpeApplyReserve> trulySelectedOrderList) { |
| | | this.trulySelectedOrderList = trulySelectedOrderList; |
| | | } |
| | | |
| | | |
| | | public Integer getTabValue() { |
| | | return tabValue; |
| | | } |
| | | |
| | | public void setTabValue(Integer tabValue) { |
| | | this.tabValue = tabValue; |
| | | } |
| | | |
| | | |
| | | public List<OpeApplyReserve> getSelectedInputStorageTmpOrderList() { |
| | | return selectedInputStorageTmpOrderList; |
| | | } |
| | | |
| | | public void setSelectedInputStorageTmpOrderList(List<OpeApplyReserve> selectedInputStorageTmpOrderList) { |
| | | this.selectedInputStorageTmpOrderList = selectedInputStorageTmpOrderList; |
| | | } |
| | | |
| | | public List<OpeApplyReserve> getTrulyInputStorageTmpSelectedOrderList() { |
| | | return trulyInputStorageTmpSelectedOrderList; |
| | | } |
| | | |
| | | public void setTrulyInputStorageTmpSelectedOrderList(List<OpeApplyReserve> trulyInputStorageTmpSelectedOrderList) { |
| | | this.trulyInputStorageTmpSelectedOrderList = trulyInputStorageTmpSelectedOrderList; |
| | | } |
| | | |
| | | public Timestamp getArrivalTime() { |
| | | return arrivalTime; |
| | | } |
| | | |
| | | public void setArrivalTime(Timestamp arrivalTime) { |
| | | this.arrivalTime = arrivalTime; |
| | | } |
| | | |
| | | public String getConsigneeId() { |
| | | return consigneeId; |
| | | } |
| | | |
| | | public void setConsigneeId(String consigneeId) { |
| | | this.consigneeId = consigneeId; |
| | | } |
| | | |
| | | public List getConsignee() { |
| | | List<SysUser> dataList = this.sysUserService.getSysUserList(null, null, null, null, null); |
| | | //将admin置于首位 |
| | | for (int i = 0; i < dataList.size(); i++) { |
| | | if ("admin".equals(dataList.get(i).getAccount())){ |
| | | dataList.add(0, dataList.remove(i)); |
| | | } |
| | | } |
| | | return dataList; |
| | | } |
| | | |
| | | public List<OpeApplyReserve> getOpeApplyList() { |
| | | return opeApplyList; |
| | | } |
| | | |
| | | public void setOpeApplyList(List<OpeApplyReserve> opeApplyList) { |
| | | this.opeApplyList = opeApplyList; |
| | | } |
| | | |
| | | |
| | | public void setArrival(OpeApplyReserve oar) { |
| | | //强制-》全到货 |
| | | oar.setArrivalNum(oar.getNum()); |
| | | } |
| | | |
| | | public void reagentStartCodeChange(OpeApplyReserve oar) { |
| | | //先输入条形码,到货数量帮填 |
| | | oar.setArrivalNum(oar.getNum()); |
| | | String startReagentCode2 = oar.getStartReagentCode2(); |
| | | String endReagentCode2 = oar.getEndReagentCode2(); |
| | | //1.如果开始条码为空,条码就为空,或者没有到货 |
| | | if (StringUtils.isBlank(startReagentCode2) |
| | | || oar.getArrivalNum() == null || oar.getArrivalNum() < 1) { |
| | | |
| | | oar.setStartReagentCode2(""); |
| | | oar.setEndReagentCode2(""); |
| | | return; |
| | | } |
| | | //2如果开始条码不为空 |
| | | //2.0如果包含字母不等于24位的直接不管 |
| | | if (startReagentCode2.matches(".*[A-F]+.*")) { |
| | | if (startReagentCode2.length() ==24){ |
| | | //2.2长度为24位编码的 |
| | | BigInteger arrNum = BigInteger.valueOf(oar.getArrivalNum().longValue()); |
| | | //后5位随机码 |
| | | String randomCode = startReagentCode2.substring(startReagentCode2.length() - 5); |
| | | String reagentCodePrefix = startReagentCode2.substring(0,startReagentCode2.length() - 5); |
| | | |
| | | BigInteger startReagentCodeSuffix = new BigInteger(randomCode); |
| | | BigInteger endReagentCodeSuffix = startReagentCodeSuffix.add(arrNum).subtract((new BigInteger("1"))); |
| | | String reagentCodeSuffix= autoGenericCode(randomCode, endReagentCodeSuffix); |
| | | oar.setEndReagentCode2(reagentCodePrefix + reagentCodeSuffix); |
| | | }else{ |
| | | oar.setEndReagentCode2(""); |
| | | } |
| | | }else{ |
| | | |
| | | BigInteger startReagentCode = new BigInteger(startReagentCode2); |
| | | //2.1长度不为24位编码 |
| | | //数据1 |
| | | BigInteger arrNum = BigInteger.valueOf(oar.getArrivalNum().longValue()); |
| | | BigInteger code1 = startReagentCode.add(arrNum).subtract(BigInteger.ONE); |
| | | oar.setEndReagentCode2(autoGenericCode(startReagentCode2, code1)); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | private String autoGenericCode(String code, BigInteger code1) { |
| | | String result = ""; |
| | | //补充位数 |
| | | result = String.format("%0" + code.length() + "d", code1); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | public void setProductSn(String productSn) { |
| | | this.productSn = productSn; |
| | | } |
| | | |
| | | public String getProductSn() { |
| | | return productSn; |
| | | } |
| | | |
| | | public String getApplyCode() { |
| | | return applyCode; |
| | | } |
| | | |
| | | public void setApplyCode(String applyCode) { |
| | | this.applyCode = applyCode; |
| | | } |
| | | |
| | | public Integer getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(Integer status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public List<ApplyStatusVo> getStatusSelectList() { |
| | | if (this.statusSelectList == null) { |
| | | this.statusSelectList = Arrays.asList(ApplyStatusVo.values()); |
| | | } |
| | | return statusSelectList; |
| | | } |
| | | |
| | | } |