| | |
| | | package com.nanometer.smartlab.controller; |
| | | |
| | | import com.nanometer.smartlab.dao.OpeApplyDao; |
| | | import com.nanometer.smartlab.dao.OpeReagentStatusDao; |
| | | import com.nanometer.smartlab.dao.OpeWarehouseReserveDao; |
| | | import com.nanometer.smartlab.dao.*; |
| | | import com.nanometer.smartlab.entity.*; |
| | | import com.nanometer.smartlab.entity.dto.ApplyListDto; |
| | | 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.entity.enumtype.*; |
| | | import com.nanometer.smartlab.exception.BusinessException; |
| | | import com.nanometer.smartlab.exception.ExceptionEnumCode; |
| | | import com.nanometer.smartlab.service.*; |
| | |
| | | import org.primefaces.model.LazyDataModel; |
| | | import org.primefaces.model.SortOrder; |
| | | import org.primefaces.model.StreamedContent; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.PropertySource; |
| | | import org.springframework.context.annotation.Scope; |
| | |
| | | import java.math.BigInteger; |
| | | import java.net.URLEncoder; |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | import java.util.stream.Collectors; |
| | |
| | | /** |
| | | * Created by cmower on 17/11/20. |
| | | */ |
| | | @Controller |
| | | @PropertySource(value = "WEB-INF/config.properties",encoding = "utf-8") |
| | | @Controller |
| | | @Scope("session") |
| | | public class WarehouseStockMngController extends BaseController { |
| | | |
| | |
| | | |
| | | @Resource |
| | | private OpeApplyService opeApplyService; |
| | | @Resource |
| | | private SysProjectDao sysProjectDao; |
| | | |
| | | @Resource |
| | | private OpeWarehouseReserveService opeWarehouseReserveService; |
| | |
| | | private SysSupplierService sysSupplierService; |
| | | @Resource |
| | | private OpeOrderService opeOrderService; |
| | | @Resource |
| | | private BaseMetaDao baseMetaDao; |
| | | |
| | | @Resource |
| | | private MenuController menuController; |
| | |
| | | OpeApplyDao opeApplyDao; |
| | | |
| | | @Resource |
| | | OpeLaboratoryReserveService opeLaboratoryReserveService; |
| | | OpeLaboratoryReserveDao opeLaboratoryReserveDao; |
| | | /** |
| | | * 数据源 |
| | | */ |
| | |
| | | * 打开条形码对话框用 |
| | | */ |
| | | private List<OpeReagentStatus> reagentStatusSelectListForPerson; |
| | | /** |
| | | *打开条形码对话框用 |
| | | */ |
| | | private Map<Long,Map<Long,OpeWarehouseReserve>> warehouseReserveUseTmp=new HashMap<>(); |
| | | /** |
| | | * 打开条形码对话框用 |
| | | */ |
| | | private List<OpeWarehouseReserve> warehouseReserveList = new ArrayList<>(); |
| | | |
| | | /** |
| | | * 打开条形码对话框用 |
| | | */ |
| | | private OpeWarehouseReserve opeWarehouseReserve = new OpeWarehouseReserve(); |
| | | |
| | | |
| | | public List<OpeReagentStatus> getReagentStatusSelectListForPerson() { |
| | | return reagentStatusSelectListForPerson; |
| | |
| | | this.reagentStatusSelectListForPerson = reagentStatusSelectListForPerson; |
| | | } |
| | | |
| | | private String reagentId; |
| | | private String reagentLogId; |
| | | private String reagentName; |
| | | private Long reagentLogId; |
| | | |
| | | private String userName; |
| | | private Integer tabValue = 0; |
| | | |
| | | private List<SysReagent> reagentSelectList; |
| | | private List<String> showCodes; |
| | | private String userId; |
| | | private String projectNum; |
| | | private String userLogId; |
| | | private Long userId; |
| | | private Long projectId; |
| | | private Long userLogId; |
| | | private String reagentCode; |
| | | private Integer useNum; |
| | | private String startReagentCode; |
| | | private String endReagentCode; |
| | | private String startReagentCodeForPerson; |
| | | private String endReagentCodeForPerson; |
| | | private String warehouseName; |
| | | |
| | | private Integer editFlag; |
| | | private Integer isAllApply = 0; |
| | | private StreamedContent file; |
| | | @Value("${pdf.export.file.path}") |
| | | private String pdfExportFilePath; |
| | | @Value("${institute.name}") |
| | | String instituteName; |
| | | |
| | | private boolean isExpired; |
| | | |
| | | private Hashtable printTable; |
| | | @Autowired |
| | | private AccountInAndOutService accountInAndOutService; |
| | | |
| | | public Hashtable getPrintTable() { |
| | | return printTable; |
| | |
| | | |
| | | private List<SysUser> userSelectList; |
| | | private List<SysUser> applyUserSelectList; |
| | | private String supplierId; |
| | | private Long supplierId; |
| | | private List<SysSupplier> supplierSelectList; |
| | | //private boolean flag = false; |
| | | |
| | | //领用单号 |
| | | private String receiptNumber; |
| | | //备注 |
| | | private String note; |
| | | // 试剂库 |
| | | private LazyDataModel<SysReagent> reagentDataModel; |
| | | // 直接入库试剂List |
| | |
| | | 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<BaseMeta> warehouseContainerPlaceList; |
| | | private Map<String, String> warehouseNameMap; |
| | | private Map<String, SysWarehouseContainer> warehouseContainerMap; |
| | | private Map<String, List<SysWarehouseContainer>> warehouseIdContainerMap; |
| | | private Map<Long, String> warehouseNameMap; |
| | | private Map<Long, SysWarehouseContainer> warehouseContainerMap; |
| | | private Map<Long, List<SysWarehouseContainer>> warehouseIdContainerMap; |
| | | |
| | | private String laboratoryId; |
| | | private String oriLaboratoryId; |
| | | private Long laboratoryId; |
| | | private Long oriLaboratoryId; |
| | | private List<SysLaboratory> laboratory; |
| | | private String laboratoryContainerId; |
| | | private Long laboratoryContainerId; |
| | | private List<SysLaboratoryContainer> laboratoryContainers; |
| | | |
| | | /** |
| | |
| | | //到货时间 |
| | | private Timestamp arrivalTime; |
| | | //收货人 |
| | | private String consigneeId; |
| | | private Long consigneeId; |
| | | //OpeApply |
| | | private List<OpeApplyReserve> opeApplyList; |
| | | /** |
| | |
| | | this.initUserSelectList(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取已领用数量 |
| | | * @param applyCode |
| | | * @return |
| | | */ |
| | | public Integer getUsedCount(String applyCode){ |
| | | return this.opeReagentStatusDao.getReagentStatusCountByApplyCode(applyCode); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | this.initUserSelectList(); |
| | | |
| | | this.warehouseList = this.sysWarehouseService.getSysWarehouseList(null, null, null, null); |
| | | this.warehouseNameMap = new HashMap<String, String>(); |
| | | this.warehouseNameMap = new HashMap<Long, 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>>(); |
| | | this.warehouseContainerMap = new HashMap<Long, SysWarehouseContainer>(); |
| | | this.warehouseIdContainerMap = new HashMap<Long, List<SysWarehouseContainer>>(); |
| | | List<SysWarehouseContainer> warehouseContainerList = this.sysWarehouseContainerService.getSysWarehouseContainerList(null, null, null, null, null); |
| | | if (warehouseContainerList != null && warehouseContainerList.size() > 0) { |
| | | for (SysWarehouseContainer container : warehouseContainerList) { |
| | |
| | | public void initInputWarehouse() { |
| | | logger.info("WarehouseStockMngController initInputWarehouse start"); |
| | | this.warehouseList = this.sysWarehouseService.getSysWarehouseList(null, null, null, null); |
| | | this.warehouseNameMap = new HashMap<String, String>(); |
| | | this.warehouseNameMap = new HashMap<Long, 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>>(); |
| | | this.warehouseContainerMap = new HashMap<Long, SysWarehouseContainer>(); |
| | | this.warehouseIdContainerMap = new HashMap<Long, List<SysWarehouseContainer>>(); |
| | | List<SysWarehouseContainer> warehouseContainerList = this.sysWarehouseContainerService.getSysWarehouseContainerList(null, null, null, null, null); |
| | | if (warehouseContainerList != null && warehouseContainerList.size() > 0) { |
| | | for (SysWarehouseContainer container : warehouseContainerList) { |
| | |
| | | |
| | | private void initUserSelectList() { |
| | | logger.info("WarehouseStockMngController initUserSelectList start"); |
| | | this.setUserSelectList(this.sysUserService.getSysUserList(null, null, null, null, null)); |
| | | this.setUserSelectList(this.sysUserService.getSysUserList(null, null, null, null, null,null,null)); |
| | | /**if(sysUserService.getSysUser(userId) == null) |
| | | { |
| | | this.laboratory = this.sysLaboratoryService.getSysLaboratoryListByDep(this.getUserDepartment()); |
| | |
| | | private void initReagentStatusSelectList() { |
| | | logger.info("WarehouseStockMngController initReagentStatusSelectList start"); |
| | | if (selectedOpeWarehouseReserve != null) { |
| | | String reagentId = selectedOpeWarehouseReserve.getReagentId(); |
| | | Long reagentId = selectedOpeWarehouseReserve.getReagentId(); |
| | | String articleNumber = selectedOpeWarehouseReserve.getArticleNumber(); |
| | | |
| | | this.setReagentStatusSelectList(opeReagentStatusService.getOpeReagentStatusList(reagentId, articleNumber, |
| | | ArrivalStatus.WAREHOUSE.getKey(), reagentCode, null, null, null)); |
| | | this.setReagentStatusSelectList(opeReagentStatusService.getOpeReagentStatusList22(reagentId, articleNumber, |
| | | ArrivalStatus.WAREHOUSE.getKey(), reagentCode, null, null,null, null)); |
| | | |
| | | // System.out.print("this.getReagentStatusSelectList().size(): " + this.reagentStatusSelectList.size()); |
| | | // System.out.print("this.getReagentStatusSelectList().get(0): " + this.reagentStatusSelectList.get(0).getReagentCode()); |
| | |
| | | private void initReagentStatusSelectListForPerson() { |
| | | logger.info("WarehouseStockMngController initReagentStatusSelectListForPerson start"); |
| | | if (selectedOpeApplyReserve != null) { |
| | | String reagentId = selectedOpeApplyReserve.getReagent().getId(); |
| | | Long reagentId = selectedOpeApplyReserve.getReagent().getId(); |
| | | String articleNumber = selectedOpeApplyReserve.getArticleNumber(); |
| | | System.out.println(reagentId); |
| | | System.out.println(articleNumber); |
| | | System.out.println(reagentCode); |
| | | this.setReagentStatusSelectListForPerson(opeReagentStatusService.getOpeReagentStatusList(reagentId, articleNumber, |
| | | ArrivalStatus.WAREHOUSE.getKey(), reagentCode, null, null, null)); |
| | | this.setReagentStatusSelectListForPerson(opeReagentStatusService.getOpeReagentStatusList22(reagentId, articleNumber, |
| | | ArrivalStatus.WAREHOUSE.getKey(), reagentCode, null, selectedOpeApplyReserve.getApplyCode(),null, null)); |
| | | |
| | | } |
| | | } |
| | |
| | | System.out.println(getUser().getSeeFlag().getKey()); |
| | | //SysUser u=sysUserService.getSysUser(getUserId()); |
| | | //System.out.println(u); |
| | | if (getUser().getSeeFlag().getKey() != SeeFlag.MANAGE.getKey()) { |
| | | if (getUser().getSeeFlag().getKey() != SeeFlag.MANAGE.getKey() |
| | | && getUser().getSeeFlag().getKey() != SeeFlag.LEADING.getKey()) { |
| | | editFlag=0; |
| | | }else{ |
| | | editFlag=1; |
| | |
| | | } |
| | | //1.判断非状态为确认的申购单不能入库 |
| | | for (OpeApplyReserve opeApplyReserve : this.selectedListForPerson) { |
| | | if (opeApplyReserve.getStatus() != ApplyStatus.SUPPLIER_CONFIRM) { |
| | | if (opeApplyReserve.getStatus() != ApplyStatus.SUPPLIER_CONFIRM && opeApplyReserve.getStatus() != ApplyStatus.UNCOMPLETED) { |
| | | FacesUtils.warn("非已确认的数据不能入库。"); |
| | | return; |
| | | } |
| | |
| | | selectedTmpOrderList = null; |
| | | } |
| | | |
| | | public void hideOrderTmp() { |
| | | //清空 |
| | | selectedTmpOrderList = null; |
| | | //隐藏 |
| | | RequestContext.getCurrentInstance().execute("document.getElementById('showTabOrder').style.display='none'"); |
| | | } |
| | | |
| | | public void clearInputStorageTmp(){ |
| | | selectedInputStorageTmpOrderList = null; |
| | | } |
| | | |
| | | public void hideInputStorageTmp(){ |
| | | selectedInputStorageTmpOrderList = null; |
| | | |
| | | RequestContext.getCurrentInstance().execute("document.getElementById('putInStorage').style.display='none'"); |
| | | } |
| | | |
| | | public void cancel(){ |
| | | if (trulySelectedList == null || trulySelectedList.size()<=0){ |
| | |
| | | |
| | | } |
| | | |
| | | public void hide(){ |
| | | selectedTmpList = null; |
| | | RequestContext.getCurrentInstance().execute("document.getElementById('showTab').style.display='none'"); |
| | | } |
| | | public void cancelOrderTmp(){ |
| | | if (trulySelectedOrderList == null || trulySelectedOrderList.size()<=0){ |
| | | FacesUtils.info("至少选择一个"); |
| | |
| | | FacesUtils.info("至少选择一个"); |
| | | return; |
| | | } |
| | | |
| | | this.userId = getUser().getId(); |
| | | this.menuController.goToPage(Constants.PAGE_WAREHOUSE_REAGENT_USE_NEW, Constants.PAGE_WAREHOUSE_STOCK_MNG); |
| | | } |
| | | // |
| | | public void onUseBtnClickOrderTmp(){ |
| | | warehouseReserveUseTmp = new HashMap<>(); |
| | | opeWarehouseReserve = new OpeWarehouseReserve(); |
| | | if (selectedTmpOrderList == null || selectedTmpOrderList.size()<=0){ |
| | | FacesUtils.info("至少选择一个"); |
| | | return; |
| | | } |
| | | |
| | | |
| | | //相同的试剂不能再多选 |
| | | Set<Long> checkTable = new HashSet<>(); |
| | | for (OpeApplyReserve oar : selectedTmpOrderList) { |
| | | Long reagentId = oar.getReagent().getId(); |
| | | if (!checkTable.contains(reagentId)) { |
| | | checkTable.add(reagentId); |
| | | }else{ |
| | | FacesUtils.info("相同试剂不能重复选择"); |
| | | return; |
| | | } |
| | | } |
| | | checkTable = null; |
| | | // |
| | | this.userId = selectedTmpOrderList.get(0).getApplyUserId(); |
| | | SysUser sysUser = sysUserService.getSysUser(this.userId); |
| | | if (sysUser == null){ |
| | | FacesUtils.info("申领人不存在"); |
| | | return; |
| | | } |
| | | this.menuController.goToPage(Constants.PAGE_WAREHOUSE_REAGENT_USE_NEW_PERSON, Constants.PAGE_WAREHOUSE_STOCK_MNG); |
| | | } |
| | | |
| | |
| | | |
| | | // 根据选择的试剂获取对应的条形码 |
| | | initReagentStatusSelectListForPerson(); |
| | | //初始化试剂库存所在仓库仓库 |
| | | this.warehouseReserveList = opeWarehouseReserveService.selectWarehouseByReagentIdAndArticleNumber(selectedOpeApplyReserve.getReagent().getId(),selectedOpeApplyReserve.getArticleNumber(),true); |
| | | //初始化第一个库存 |
| | | if (warehouseReserveList.size()>0) |
| | | selectChangeReserve(warehouseReserveList.get(0).getWarehouseId()); |
| | | //初始化条形码,通过applyReserve保存的条码显示对应试剂的条码 |
| | | for (OpeApplyReserve oar : selectedTmpOrderList) { |
| | | if (oar.getReagent().getId().equals(opeWarehouseReserve.getReagentId())) { |
| | | this.endReagentCodeForPerson = oar.getEndReagentCode2(); |
| | | this.startReagentCodeForPerson = oar.getStartReagentCode2(); |
| | | } |
| | | } |
| | | if (warehouseReserveUseTmp.get(selectedOpeApplyReserve.getReagent().getId()) == null) { |
| | | //初始化库中领用和大小, |
| | | reagentCodeSelectedList = selectedOpeApplyReserve.getReagentCodes(); |
| | | useNum = selectedOpeApplyReserve.getReagentCodes() == null?0: selectedOpeApplyReserve.getReagentCodes().size(); |
| | | this.endReagentCodeForPerson = null; |
| | | this.startReagentCodeForPerson = null; |
| | | } |
| | | |
| | | RequestContext.getCurrentInstance().execute("PF('reagentCodeDialogForPerson').show()"); |
| | | } |
| | | /** |
| | | * 变换库存 |
| | | */ |
| | | public void selectChangeReserve(Long id) { |
| | | if (warehouseReserveList.size() > 0) { |
| | | warehouseReserveList.forEach(owr -> { |
| | | if (owr.getWarehouseId().equals(id)){ |
| | | opeWarehouseReserve.setId(owr.getId()); |
| | | opeWarehouseReserve.setWarehouseId(id); |
| | | opeWarehouseReserve.setWarehouseName(owr.getWarehouseName()); |
| | | opeWarehouseReserve.setReserve(owr.getReserve()); |
| | | opeWarehouseReserve.setReagentId(owr.getReagentId()); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 补贴条码->添加x仓库的n个试剂 |
| | | */ |
| | | public void add2() { |
| | | |
| | | //0.判断该批次是否再仓库有库存 |
| | | if (opeWarehouseReserve.getId() == null) { |
| | | FacesUtils.warn("没有库存"); |
| | | return; |
| | | } |
| | | //1.判断领取数量 |
| | | if (useNum > opeWarehouseReserve.getReserve()) { |
| | | FacesUtils.warn("领用数量不能超过库存"); |
| | | return; |
| | | } |
| | | //2.加入Map |
| | | OpeWarehouseReserve owr = new OpeWarehouseReserve(); |
| | | owr.setId(opeWarehouseReserve.getId()); |
| | | owr.setWarehouseId(opeWarehouseReserve.getWarehouseId()); |
| | | owr.setWarehouseName(opeWarehouseReserve.getWarehouseName()); |
| | | owr.setReserve(opeWarehouseReserve.getReserve()); |
| | | owr.setReagentId(opeWarehouseReserve.getReagentId()); |
| | | owr.setUseNum(useNum); |
| | | if (warehouseReserveUseTmp.get(owr.getReagentId()) == null) { |
| | | Map<Long, OpeWarehouseReserve> tmp = new HashMap<>(); |
| | | tmp.put(owr.getWarehouseId(), owr); |
| | | warehouseReserveUseTmp.put(owr.getReagentId(), tmp); |
| | | }else{ |
| | | warehouseReserveUseTmp.get(owr.getReagentId()).put(owr.getWarehouseId(), owr); |
| | | } |
| | | //变换条码 |
| | | btCodeChange(); |
| | | } |
| | | |
| | | /** |
| | | * 取消一个仓库领取 |
| | | */ |
| | | public void remove2(OpeWarehouseReserve owr) { |
| | | if (warehouseReserveUseTmp.get(owr.getReagentId()).size() > 0) { |
| | | warehouseReserveUseTmp.get(owr.getReagentId()).remove(owr.getWarehouseId()); |
| | | //变换条码 |
| | | btCodeChange(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取暂存表单 |
| | | */ |
| | | public List<OpeWarehouseReserve> getDataTmp() { |
| | | |
| | | List<OpeWarehouseReserve> list = new ArrayList<>(); |
| | | |
| | | |
| | | Map<Long, OpeWarehouseReserve> dataMap = warehouseReserveUseTmp. |
| | | get(opeWarehouseReserve.getReagentId()); |
| | | if (dataMap ==null) { |
| | | return list; |
| | | } |
| | | Set<Map.Entry<Long, OpeWarehouseReserve>> entries = dataMap.entrySet(); |
| | | for (Map.Entry<Long, OpeWarehouseReserve> e : entries) { |
| | | list.add(e.getValue()); |
| | | } |
| | | return list; |
| | | } |
| | | /** |
| | | * @Description: 补贴结束条码的生成 |
| | | */ |
| | | public void btCodeChange(){ |
| | | //1.获取补贴试剂总数 |
| | | List<OpeWarehouseReserve> dataTmp = getDataTmp(); |
| | | int distance = dataTmp.stream().mapToInt(item -> item.getUseNum() == null ? 0 : item.getUseNum()).sum(); |
| | | |
| | | //1.如果开始条码为空,距离为0 |
| | | if (StringUtils.isBlank(startReagentCodeForPerson) |
| | | || distance < 1) { |
| | | return; |
| | | } |
| | | //2如果开始条码不为空 |
| | | //2.0如果包含字母不等于24位的直接不管 |
| | | if (startReagentCodeForPerson.matches(".*\\D+.*")) { |
| | | if (startReagentCodeForPerson.length() ==24 && |
| | | startReagentCodeForPerson.matches(".*([A-F]|\\d)+.*") && |
| | | startReagentCodeForPerson.substring(startReagentCodeForPerson.length() - 5).matches("\\d{5}")){ |
| | | //2.2长度为24位编码的 |
| | | BigInteger arrNum = BigInteger.valueOf(distance); |
| | | //后5位随机码 |
| | | String randomCode = startReagentCodeForPerson.substring(startReagentCodeForPerson.length() - 5); |
| | | String reagentCodePrefix = startReagentCodeForPerson.substring(0,startReagentCodeForPerson.length() - 5); |
| | | |
| | | BigInteger startReagentCodeSuffix = new BigInteger(randomCode); |
| | | BigInteger endReagentCodeSuffix = startReagentCodeSuffix.add(arrNum).subtract((new BigInteger("1"))); |
| | | String reagentCodeSuffix= autoGenericCode(randomCode, endReagentCodeSuffix); |
| | | endReagentCodeForPerson = (reagentCodePrefix + reagentCodeSuffix); |
| | | }else{ |
| | | endReagentCodeForPerson = (""); |
| | | } |
| | | }else{ |
| | | |
| | | BigInteger startReagentCode = new BigInteger(startReagentCodeForPerson); |
| | | //2.1长度不为24位编码 |
| | | //数据1 |
| | | BigInteger arrNum = BigInteger.valueOf(distance); |
| | | BigInteger code1 = startReagentCode.add(arrNum).subtract(BigInteger.ONE); |
| | | endReagentCodeForPerson = (autoGenericCode(startReagentCodeForPerson, code1)); |
| | | } |
| | | //把数据放入applyReserve |
| | | for (OpeApplyReserve oar : selectedTmpOrderList) { |
| | | if (oar.getReagent().getId().equals(this.opeWarehouseReserve.getReagentId())) { |
| | | oar.setEndReagentCode2(endReagentCodeForPerson); |
| | | oar.setStartReagentCode2(startReagentCodeForPerson); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public void onYesBtnClickForPerson() { |
| | | try { |
| | |
| | | // 将当前选择条形码保存到库存中 |
| | | for (OpeApplyReserve opeApplyReserve : this.selectedTmpOrderList) { |
| | | if (opeApplyReserve.getId().equals(this.selectedOpeApplyReserve.getId())) { |
| | | //list OpeWarehouseReserve |
| | | //getReserve 总数小于 useNum 报错 |
| | | |
| | | OpeWarehouseReserve wa=opeWarehouseReserveService.getOpeWarehouseReserve(opeApplyReserve.getReagent().getId(),opeApplyReserve.getArticleNumber()); |
| | | if(this.useNum > wa.getReserve()) |
| | | { |
| | |
| | | opeApplyReserve.setSelectNum(useNum); |
| | | if(this.reagentCodeSelectedList != null) |
| | | { |
| | | opeApplyReserve.setReagentCode(this.reagentCodeSelectedList); |
| | | opeApplyReserve.setReagentCodes(this.reagentCodeSelectedList); |
| | | } |
| | | opeApplyReserve.setFlag(1); |
| | | //删除前面部分的补贴条码领用显示 |
| | | warehouseReserveUseTmp.remove(opeApplyReserve.getReagent().getId()); |
| | | endReagentCodeForPerson = null; |
| | | startReagentCodeForPerson = null; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | //FacesUtils.info("选择条形码个数为" + this.reagentCodeSelectedList.size()); |
| | | RequestContext.getCurrentInstance().execute("PF('reagentCodeDialogForPerson').hide()"); |
| | |
| | | |
| | | public void onYesBtnClickForPerson2() { |
| | | try { |
| | | //if (this.reagentCodeSelectedList == null || this.reagentCodeSelectedList.size() == 0) { |
| | | //FacesUtils.warn("请选择条形码。"); |
| | | //return; |
| | | //} |
| | | |
| | | if(this.useNum == null || this.useNum <= 0) |
| | | { |
| | | FacesUtils.warn("请输入大于0的领用数量!"); |
| | | //1.获取补贴试剂总数,判断数量 |
| | | List<OpeWarehouseReserve> dataTmp = getDataTmp(); |
| | | //distance为领用总数 |
| | | int distance = dataTmp.stream().mapToInt(item -> item.getUseNum() == null ? 0 : item.getUseNum()).sum(); |
| | | if (distance < 1) { |
| | | FacesUtils.warn("请领取试剂"); |
| | | return; |
| | | } |
| | | System.out.println("====onYesBtnClick======"); |
| | | BigDecimal startReagentCode2 = new BigDecimal(startReagentCodeForPerson); |
| | | BigDecimal endReagentCode2 = new BigDecimal(endReagentCodeForPerson); |
| | | // 检查条形码结束要大于条形码开始 |
| | | if (endReagentCode2.compareTo(startReagentCode2) == -1) { |
| | | FacesUtils.warn("条形码开始必须小于条形码结束。"); |
| | | //2.申购单已经领用的数量+当前准备领用的数量不能超过 单子的申请数量 |
| | | if (selectedOpeApplyReserve.getNum() < selectedOpeApplyReserve.getUsed() + distance) { |
| | | FacesUtils.warn("当前领用数量超过订单的申请数量"); |
| | | return; |
| | | } |
| | | // 检查条形码和到货数量是否匹配 |
| | | if (endReagentCode2.subtract(startReagentCode2).intValue() != (useNum - 1)) { |
| | | FacesUtils.warn("条形码数量和领用数量不一致。"); |
| | | return; |
| | | } |
| | | |
| | | BigInteger startReagentCode3=new BigInteger(startReagentCodeForPerson); |
| | | BigInteger endReagentCode3=new BigInteger(endReagentCodeForPerson); |
| | | int len = startReagentCodeForPerson.length() - String.valueOf(startReagentCode3).length(); |
| | | String temp = ""; |
| | | for (int i = 0; i < len; i++) { |
| | | temp += "0"; |
| | | } |
| | | String str=""; |
| | | for (BigInteger i = startReagentCode3; i.compareTo(endReagentCode3) < 1; i = i.add(BigInteger.ONE)) { |
| | | String code = temp + String.valueOf(i); |
| | | OpeReagentStatus status=this.opeReagentStatusService.getOpeReagentStatusByReagentCode(code); |
| | | if(status==null){ |
| | | |
| | | }else{ |
| | | if(status.getStatus()==ArrivalStatus.WAREHOUSE){ |
| | | |
| | | }else{ |
| | | str+=code+","; |
| | | } |
| | | } |
| | | } |
| | | if(str!=null && !str.equals("")){ |
| | | FacesUtils.info("条形码"+str.substring(0,str.length()-1)+"已被领用"); |
| | | return; |
| | | } |
| | | |
| | | List<String> codeList = opeReagentStatusService |
| | | .checkReagentCode(startReagentCodeForPerson, endReagentCodeForPerson, distance); |
| | | |
| | | |
| | | // 将当前选择条形码保存到库存中 |
| | | 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("库存不够,请确认或申购!"); |
| | | // return; |
| | | // } |
| | | if (this.useNum+opeApplyReserve.getUsed() > opeApplyReserve.getNum()){ |
| | | FacesUtils.warn("领用数量超出申请数量!"); |
| | | return; |
| | | } |
| | | opeApplyReserve.setSelectNum(useNum); |
| | | opeApplyReserve.setStartReagentCode(startReagentCode2); |
| | | opeApplyReserve.setEndReagentCode(endReagentCode2); |
| | | opeApplyReserve.setStartReagentCode2(temp+startReagentCode2.toString()); |
| | | opeApplyReserve.setEndReagentCode2(temp+endReagentCode2.toString()); |
| | | for (BigInteger i = new BigInteger(startReagentCodeForPerson); i.compareTo(new BigInteger(endReagentCodeForPerson)) < 1; i = i.add(BigInteger.ONE)) { |
| | | codeList.add(i.toString()); |
| | | } |
| | | /*for(int i=Integer.parseInt(startReagentCodeForPerson);i<=Integer.parseInt(endReagentCodeForPerson);i++){ |
| | | codeList.add(Integer.toString(i)); |
| | | }*/ |
| | | if(codeList != null) |
| | | { |
| | | opeApplyReserve.setReagentCode(codeList); |
| | | } |
| | | opeApplyReserve.setSelectNum(distance); |
| | | opeApplyReserve.setStartReagentCode2(this.startReagentCodeForPerson); |
| | | opeApplyReserve.setEndReagentCode2(this.endReagentCodeForPerson); |
| | | opeApplyReserve.setReagentCodes(codeList); |
| | | opeApplyReserve.setCacheUpdateList(getDataTmp()); |
| | | opeApplyReserve.setFlag(0); |
| | | reagentCodeSelectedList = null; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //FacesUtils.info("选择条形码个数为" + codeList.size()); |
| | | RequestContext.getCurrentInstance().execute("PF('reagentCodeDialogForPerson').hide()"); |
| | | } catch (BusinessException e) { |
| | | logger.error("操作失败。", e); |
| | | FacesUtils.warn(e.getMessage()); |
| | | } catch (Exception e) { |
| | | logger.error("操作失败。", e); |
| | | FacesUtils.warn("操作失败。"); |
| | |
| | | } |
| | | |
| | | public void onYesBtnClick2(){ |
| | | try{ |
| | | if(this.useNum == null || this.useNum <= 0) |
| | | { |
| | | try { |
| | | if (this.useNum == null || this.useNum <= 0) { |
| | | FacesUtils.warn("请输入大于0的领用数量!"); |
| | | return; |
| | | } |
| | | BigDecimal startReagentCode2 = new BigDecimal(startReagentCode); |
| | | BigDecimal endReagentCode2 = new BigDecimal(endReagentCode); |
| | | // 检查条形码结束要大于条形码开始 |
| | | if (endReagentCode2.compareTo(startReagentCode2) == -1) { |
| | | FacesUtils.warn("条形码开始必须小于条形码结束。"); |
| | | return; |
| | | } |
| | | // 检查条形码和到货数量是否匹配 |
| | | if (endReagentCode2.subtract(startReagentCode2).intValue() != (useNum - 1)) { |
| | | FacesUtils.warn("条形码数量和领用数量不一致。"); |
| | | return; |
| | | } |
| | | BigInteger startReagentCode3=new BigInteger(startReagentCode); |
| | | BigInteger endReagentCode3=new BigInteger(endReagentCode); |
| | | int len = startReagentCode.length() - String.valueOf(startReagentCode3).length(); |
| | | List<String> codeList = opeReagentStatusService |
| | | .checkReagentCode(startReagentCode, endReagentCode, useNum); |
| | | |
| | | String temp = ""; |
| | | for (int i = 0; i < len; i++) { |
| | | temp += "0"; |
| | | } |
| | | String str=""; |
| | | for (BigInteger i = startReagentCode3; i.compareTo(endReagentCode3) < 1; i = i.add(BigInteger.ONE)) { |
| | | String code = temp + String.valueOf(i); |
| | | OpeReagentStatus status=this.opeReagentStatusService.getOpeReagentStatusByReagentCode(code); |
| | | if(status==null){ |
| | | |
| | | }else{ |
| | | if(status.getStatus()==ArrivalStatus.WAREHOUSE){ |
| | | |
| | | }else{ |
| | | str+=code+","; |
| | | } |
| | | } |
| | | } |
| | | if(str!=null && !str.equals("")){ |
| | | FacesUtils.info("条形码"+str.substring(0,str.length()-1)+"已被领用"); |
| | | return; |
| | | } |
| | | |
| | | List<String> codeList=new ArrayList<>(); |
| | | for (OpeWarehouseReserve opeWarehouseReserve : this.selectedTmpList) { |
| | | if (opeWarehouseReserve.getId().equals(this.selectedOpeWarehouseReserve.getId())) { |
| | | if(this.useNum > opeWarehouseReserve.getReserve()) |
| | | { |
| | | if (this.useNum > opeWarehouseReserve.getReserve()) { |
| | | FacesUtils.warn("库存不够,请确认或申购!"); |
| | | return; |
| | | } |
| | | opeWarehouseReserve.setSelectNum(useNum); |
| | | opeWarehouseReserve.setStartReagentCode(startReagentCode2); |
| | | opeWarehouseReserve.setEndReagentCode(endReagentCode2); |
| | | opeWarehouseReserve.setStartReagentCode2(temp+startReagentCode2.toString()); |
| | | opeWarehouseReserve.setEndReagentCode2(temp+endReagentCode2.toString()); |
| | | for (BigInteger i = new BigInteger(startReagentCode); i.compareTo(new BigInteger(endReagentCode)) < 1; i = i.add(BigInteger.ONE)) { |
| | | codeList.add(i.toString()); |
| | | } |
| | | /*for(int i=Integer.parseInt(startReagentCode);i<=Integer.parseInt(endReagentCode);i++){ |
| | | codeList.add(Integer.toString(i)); |
| | | }*/ |
| | | if(codeList != null) |
| | | { |
| | | opeWarehouseReserve.setStartReagentCode2(startReagentCode); |
| | | opeWarehouseReserve.setEndReagentCode2(endReagentCode); |
| | | |
| | | if (codeList != null) { |
| | | opeWarehouseReserve.setReagentCodes(codeList); |
| | | } |
| | | opeWarehouseReserve.setFlag(0); |
| | |
| | | } |
| | | //FacesUtils.info("选择条形码个数为" + codeList.size()); |
| | | RequestContext.getCurrentInstance().execute("PF('reagentCodeDialog').hide()"); |
| | | } catch (Exception e) { |
| | | logger.error("操作失败。", e); |
| | | FacesUtils.warn("操作失败。"); |
| | | } |
| | | } catch (BusinessException e) { |
| | | logger.error(e.getMessage()); |
| | | FacesUtils.warn(e.getMessage()); |
| | | } catch (Exception e) { |
| | | logger.error("操作失败。", e); |
| | | FacesUtils.warn("操作失败。"); |
| | | } |
| | | } |
| | | |
| | | public void onYesBtnClick() { |
| | |
| | | this.selectedTmpOrderList = null; |
| | | this.selectedTmpList = null; |
| | | this.selectedInputStorageTmpOrderList = null; |
| | | this.endReagentCodeForPerson = null; |
| | | this.startReagentCodeForPerson = null; |
| | | this.laboratoryId = null; |
| | | this.useNum = null; |
| | | this.menuController.backToPage(); |
| | | } |
| | | |
| | |
| | | FacesUtils.warn("请选择申领人。"); |
| | | return; |
| | | } |
| | | |
| | | List<OpeApplyReserve> list=new ArrayList<>(); |
| | | List<OpeApplyReserve> list2=new ArrayList<>(); |
| | | //int size = 0; |
| | | for(OpeApplyReserve app:this.selectedTmpOrderList){ |
| | | if (app.getFlag() == null) { |
| | | FacesUtils.warn("请选择。"); |
| | | return; |
| | | } |
| | | if(app.getFlag()==1){ |
| | | list.add(app); |
| | | }else { |
| | | list2.add(app); |
| | | } |
| | | |
| | | } |
| | | |
| | | //1.1判断库存 |
| | | checkReserve(list); |
| | | checkReserve(list2); |
| | | //1.2判断提交的条码是否重复(只有补贴条码需要判断) |
| | | checkReagentCode(list2); |
| | | String receiptNum = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()); |
| | | //库中领取 |
| | | if(list.size()>0&&list!=null){ |
| | | //扣库存 对象中的reagentCode存的是id |
| | | |
| | | for(OpeApplyReserve app:list){ |
| | | List<String> reagentCode=app.getReagentCode(); |
| | | if(reagentCode!=null && reagentCode.size()>0){ |
| | | for(String opeReagentStatusId:reagentCode){ |
| | | OpeReagentStatus opeReagentStatus=this.opeReagentStatusService.getOpeReagentStatus(opeReagentStatusId); |
| | | List<String> reagentCodes=app.getReagentCodes(); |
| | | if(reagentCodes!=null && reagentCodes.size()>0){ |
| | | for(String reagentCode:reagentCodes){ |
| | | OpeReagentStatus opeReagentStatus=this.opeReagentStatusService.getOpeReagentStatusByCode(reagentCode); |
| | | if (!this.opeReagentStatusService.isAllowWarehouseUse(opeReagentStatus)) { |
| | | FacesUtils.warn("只能申领在仓库的试剂。"); |
| | | return; |
| | | }else { |
| | | opeReagentStatus.setHouseId(laboratoryId); |
| | | opeReagentStatus.setContainerId(laboratoryContainerId); |
| | | this.opeReagentStatusDao.updateOpeReagentStatusDao(opeReagentStatus); |
| | | OpeLaboratoryReserve lr=new OpeLaboratoryReserve(); |
| | | lr.setReagentId(app.getReagent().getId()); |
| | | lr.setHouseId(laboratoryId); |
| | | lr.setContainerId(laboratoryContainerId); |
| | | lr.setReserve(app.getSelectNum()); |
| | | lr.setUserId(userId); |
| | | lr.setValidFlag(ValidFlag.VALID); |
| | | this.opeLaboratoryReserveService.insert(lr); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.opeWarehouseReserveService.claimForPerson(list, userId,projectNum); |
| | | this.opeWarehouseReserveService.claimForPerson(list, userId,projectId,laboratoryId,laboratoryContainerId,receiptNum); |
| | | } |
| | | |
| | | //补贴条码 |
| | | if(list2.size()>0&&list!=null){ |
| | | List<OpeApply> opeList=new ArrayList<>(); |
| | | for(int i=0;i<list2.size();i++){ |
| | |
| | | opeApply.setReagent(list2.get(i).getReagent()); |
| | | opeApply.setStartReagentCode(list2.get(i).getStartReagentCode2()); |
| | | opeApply.setEndReagentCode(list2.get(i).getEndReagentCode2()); |
| | | opeApply.setReagentCodeList(list2.get(i).getReagentCodes()); |
| | | opeApply.setId(list2.get(i).getId()); |
| | | opeList.add(opeApply); |
| | | OpeLaboratoryReserve lr=new OpeLaboratoryReserve(); |
| | | lr.setReagentId(list2.get(i).getReagent().getId()); |
| | |
| | | lr.setReserve(list2.get(i).getSelectNum()); |
| | | lr.setUserId(userId); |
| | | lr.setValidFlag(ValidFlag.VALID); |
| | | this.opeLaboratoryReserveService.insert(lr); |
| | | this.opeLaboratoryReserveDao.insertOpeLaboratoryReserve(lr); |
| | | } |
| | | this.opeWarehouseReserveService.reagentDStore2(opeList,userId); |
| | | this.opeWarehouseReserveService.reagentDStore3(opeList,userId); |
| | | |
| | | //扣库存 |
| | | opeWarehouseReserveService.btWarehouseReserveReduce(list2); |
| | | } |
| | | |
| | | for(int i=0;i<list2.size();i++){ |
| | | OpeWarehouseReserve opeWarehouseReserve=new OpeWarehouseReserve(); |
| | | |
| | | OpeApplyReserve re=new OpeApplyReserve(); |
| | | re.setUsed(list2.get(i).getSelectNum()+list2.get(i).getUsed()); |
| | | re.setId(list2.get(i).getId()); |
| | | opeApplyDao.updateOpeApplyUsed(re);//修改已领数量 |
| | | } |
| | | |
| | | //更新申购单状态 |
| | | for (OpeApplyReserve oar : selectedTmpOrderList) { |
| | | //确认 |
| | | if (oar.getStatus() == ApplyStatus.SUPPLIER_CONFIRM) { |
| | | //领用完 就改成已经入库 |
| | | if (oar.getNum() == oar.getUsed() + oar.getSelectNum()) { |
| | | opeApplyService.updateOpeApplyInfo(ApplyStatus.STORAGE,null,null, oar.getId(),null); |
| | | //2.2更改订单状态 |
| | | OpeOrder oo = opeOrderService.getOrder(oar.getId()); |
| | | List<OpeApply> oas = opeOrderService.getOpeApplyListByOrder(oo.getId()); |
| | | assert oas.size() > 0; |
| | | //子订单是否全部入库,是则父单为已入库,否则未完成 |
| | | boolean flag = oas.stream().allMatch(oa -> oa.getStatus() == ApplyStatus.STORAGE); |
| | | oo.setArrivalTime(arrivalTime); |
| | | if (flag){ |
| | | oo.setStatus(ApplyStatus.STORAGE); |
| | | opeOrderService.updateOpeOrderStatus(oo); |
| | | }else{ |
| | | oo.setStatus(ApplyStatus.UNCOMPLETED); |
| | | opeOrderService.updateOpeOrder(oo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | FacesUtils.info("申领成功。"); |
| | | this.menuController.goToPage(Constants.PAGE_WAREHOUSE_STOCK_MNG, Constants.PAGE_WAREHOUSE_REAGENT_USE_NEW); |
| | | } catch (Exception e) { |
| | | //领用单生成 |
| | | printTable = null; |
| | | printTable = new Hashtable(); |
| | | int sum = 0; |
| | | List<ApplyListDto> applyList = new ArrayList<>(); |
| | | SysUser applyPersonInfo = sysUserService.getUser(userId); |
| | | if (applyPersonInfo == null) { |
| | | FacesUtils.warn("申领人不存在或者申领人部门被删除。"); |
| | | return; |
| | | } |
| | | printTable.put("head", instituteName); |
| | | printTable.put("title", "领用单"); |
| | | printTable.put("applyPerson", applyPersonInfo.getName()); |
| | | printTable.put("department", applyPersonInfo.getDepartmentName()); |
| | | printTable.put("date", Utils.now("yyyy-MM-dd")); |
| | | |
| | | printTable.put("receiptNumber", receiptNum); |
| | | if (StringUtils.isNotBlank(applyPersonInfo.getPhone())){ |
| | | printTable.put("phone", applyPersonInfo.getPhone()); |
| | | } |
| | | if (applyPersonInfo.getProjectId()!=null){ |
| | | SysProject sysProject=this.sysProjectDao.getSysProject(applyPersonInfo.getProjectId()); |
| | | if(sysProject!=null){ |
| | | printTable.put("project", sysProject.getProjectName()); |
| | | } |
| | | } |
| | | SysLaboratory lab = sysLaboratoryService.getSysLaboratory(laboratoryId); |
| | | printTable.put("lab", lab.getName()); |
| | | this.receiptNumber = receiptNum; |
| | | for (OpeApplyReserve oar : selectedTmpOrderList) { |
| | | ApplyListDto lis = new ApplyListDto(); |
| | | Map reagentDetail = sysReagentService.getReagentDetail(oar.getReagent().getId()); |
| | | lis.setNum(String.valueOf(oar.getSelectNum())); //数量 |
| | | lis.setMainMetering(String.format("%s%s", reagentDetail.get("main_metering"), reagentDetail.get("unit"))); |
| | | lis.setControlProducts((String) reagentDetail.get("controlProducts")); |
| | | lis.setProductName((String) reagentDetail.get("name")); |
| | | lis.setReagentFormat((String) reagentDetail.get("reagentFormat")); |
| | | lis.setProductCode((String)reagentDetail.get("productCode")); |
| | | lis.setMemo((String)reagentDetail.get("memo")); |
| | | applyList.add(lis); |
| | | sum += oar.getSelectNum(); |
| | | } |
| | | applyList.add(new ApplyListDto("合计", "", "", "", "", String.valueOf(sum), "")); |
| | | printTable.put("applyList", applyList); |
| | | //返回 |
| | | // onCancelBtnClick(); |
| | | RequestContext.getCurrentInstance().execute("PF('printDialog').show()"); |
| | | } catch (BusinessException e){ |
| | | logger.info(e.getMessage()); |
| | | FacesUtils.warn(e.getMessage()); |
| | | } |
| | | catch (Exception e) { |
| | | logger.error("操作失败。", e); |
| | | FacesUtils.warn("操作失败。"); |
| | | } |
| | | } |
| | | |
| | | public void receiptNumberChange( ){ |
| | | } |
| | | |
| | | /** |
| | | * 点击打印 关联所有流向和领用单号e |
| | | */ |
| | | public void associatedFlowReceiptNumber() { |
| | | try { |
| | | opeUseFlowService.updateReceiptNumberByCode(selectedTmpOrderList, receiptNumber, note); |
| | | //弹出打印窗口 |
| | | RequestContext.getCurrentInstance().execute("document.getElementById('indirectPrint').click()"); |
| | | } catch (Exception e) { |
| | | logger.info(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 点击打印 关联所有流向和领用单号e |
| | | */ |
| | | |
| | | |
| | | public void associatedFlowReceiptNumber2() { |
| | | try { |
| | | opeUseFlowService.updateReceiptNumberByCode2(selectedTmpList, receiptNumber,note); |
| | | //弹出打印窗口 |
| | | RequestContext.getCurrentInstance().execute("document.getElementById('indirectPrint').click()"); |
| | | } catch (Exception e) { |
| | | logger.info(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public void closeDialog() { |
| | | try { |
| | | opeUseFlowService.updateReceiptNumberByCode(selectedTmpOrderList, receiptNumber,note); |
| | | onCancelBtnClick(); |
| | | } catch (Exception e) { |
| | | logger.info(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | public void closeDialog2() { |
| | | try { |
| | | opeUseFlowService.updateReceiptNumberByCode2(selectedTmpList, receiptNumber,note); |
| | | onCancelBtnClick(); |
| | | } catch (Exception e) { |
| | | logger.info(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | private void checkReserve(List<OpeApplyReserve> list) { |
| | | if (list == null || list.size() < 1) { |
| | | return; |
| | | } |
| | | for (OpeApplyReserve oar : list) { |
| | | |
| | | boolean flag = (oar.getFlag() != 1); |
| | | List<OpeWarehouseReserve> owr = opeWarehouseReserveService |
| | | .selectWarehouseByReagentIdAndArticleNumber(oar.getReagent().getId(), oar.getArticleNumber(),flag); |
| | | int sum = owr.stream().mapToInt(item -> item.getReserve() == null ? 0 : item.getReserve()).sum(); |
| | | //剩余库存不足领取数量 |
| | | if (sum < oar.getSelectNum()) { |
| | | throw new BusinessException(ExceptionEnumCode.APPLY_NUM_OVER, "库存已经不够"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void checkReagentCode(List<OpeApplyReserve> list){ |
| | | if (list == null || list.size() < 1) { |
| | | return; |
| | | } |
| | | Set<String> checkSet = new HashSet<>(); |
| | | for (OpeApplyReserve oar : list) { |
| | | List<String> codeList = opeReagentStatusService |
| | | .checkReagentCode(oar.getStartReagentCode2(), oar.getEndReagentCode2(), oar.getSelectNum()); |
| | | oar.setReagentCodes(codeList); |
| | | if (codeList != null && codeList.size() > 0) { |
| | | for (String code:codeList) { |
| | | if (!checkSet.contains(code)) { |
| | | checkSet.add(code); |
| | | }else{ |
| | | throw new BusinessException(ExceptionEnumCode.PARAM_EXIST, "当前订单条码重复,"+code); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public void onSaveBtnClick() { |
| | | try { |
| | | if (this.selectedTmpList == null || this.selectedTmpList.size() == 0) { |
| | |
| | | printTable = null; |
| | | printTable = new Hashtable(); |
| | | List<ApplyListDto> applyList = new ArrayList<>(); |
| | | Map applyPersonInfo = sysUserService.getUser(userId); |
| | | SysUser applyPersonInfo = sysUserService.getUser(userId); |
| | | if (applyPersonInfo == null) { |
| | | FacesUtils.warn("申领人不存在或者申领人部门被删除。"); |
| | | return; |
| | | } |
| | | printTable.put("head", instituteName); |
| | | printTable.put("title", "领用单"); |
| | | printTable.put("applyPerson", applyPersonInfo.get("name")); |
| | | printTable.put("department", applyPersonInfo.get("meta_value")); |
| | | printTable.put("applyPerson", applyPersonInfo.getName()); |
| | | printTable.put("department", applyPersonInfo.getDepartmentName()); |
| | | printTable.put("date", Utils.now("yyyy-MM-dd")); |
| | | printTable.put("phone", applyPersonInfo.get("phone")); |
| | | if (StringUtils.isNotBlank(applyPersonInfo.getPhone())){ |
| | | printTable.put("phone", applyPersonInfo.getPhone()); |
| | | } |
| | | if (applyPersonInfo.getProjectId()!=null){ |
| | | SysProject sysProject=this.sysProjectDao.getSysProject(applyPersonInfo.getProjectId()); |
| | | if(sysProject!=null){ |
| | | printTable.put("project", sysProject.getProjectName()); |
| | | } |
| | | } |
| | | SysLaboratory lab = sysLaboratoryService.getSysLaboratorySimpleInfo(laboratoryId); |
| | | String receiptNum = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()); |
| | | printTable.put("receiptNumber", receiptNum); |
| | | printTable.put("lab", lab.getName()); |
| | | this.receiptNumber = receiptNum; |
| | | |
| | | //int size = 0; |
| | | int sum = 0; |
| | | List<OpeWarehouseReserve> list=new ArrayList<>(); |
| | | List<OpeWarehouseReserve> list2=new ArrayList<>(); |
| | | for (OpeWarehouseReserve selectWarehouseReserve : this.selectedTmpList) { |
| | | if(selectWarehouseReserve.getFlag()==1){ |
| | | list.add(selectWarehouseReserve); |
| | | }else{ |
| | | list2.add(selectWarehouseReserve); |
| | | } |
| | | list.add(selectWarehouseReserve); |
| | | } |
| | | |
| | | if(list.size()>0&&list!=null){ |
| | | for (OpeWarehouseReserve selectWarehouseReserve : list) { |
| | | List<String> reagentCodes = selectWarehouseReserve.getReagentCodes(); |
| | | if (reagentCodes != null && reagentCodes.size() > 0) |
| | | for (String opeReagentStatusId : reagentCodes) { |
| | | OpeReagentStatus opeReagentStatus = this.opeReagentStatusService |
| | | .getOpeReagentStatus(opeReagentStatusId); |
| | | if (!this.opeReagentStatusService.isAllowWarehouseUse(opeReagentStatus)) { |
| | | FacesUtils.warn("只能申领在仓库的试剂。"); |
| | | return; |
| | | }else { |
| | | opeReagentStatus.setHouseId(laboratoryId); |
| | | opeReagentStatus.setContainerId(laboratoryContainerId); |
| | | this.opeReagentStatusDao.updateOpeReagentStatusDao(opeReagentStatus);//更新试剂状态表 |
| | | OpeLaboratoryReserve lr=new OpeLaboratoryReserve(); |
| | | lr.setReagentId(selectWarehouseReserve.getReagentId()); |
| | | lr.setHouseId(laboratoryId); |
| | | lr.setContainerId(laboratoryContainerId); |
| | | lr.setReserve(selectWarehouseReserve.getSelectNum()); |
| | | lr.setUserId(userId); |
| | | lr.setValidFlag(ValidFlag.VALID); |
| | | this.opeLaboratoryReserveService.insert(lr); |
| | | } |
| | | //else { |
| | | //size++; |
| | | //} |
| | | } |
| | | ApplyListDto lis = new ApplyListDto(); |
| | | Map reagentDetail = sysReagentService.getReagentDetail(selectWarehouseReserve.getReagentId()); |
| | | if (reagentDetail == null) { |
| | | throw new Exception("试剂有误,请联系管理员"); |
| | | } |
| | | ApplyListDto lis = new ApplyListDto(); |
| | | lis.setNum(String.valueOf(selectWarehouseReserve.getSelectNum())); //数量 |
| | | lis.setMainMetering(String.format("%s%s", reagentDetail.get("main_metering"), reagentDetail.get("unit"))); |
| | | lis.setControlProducts((String) reagentDetail.get("controlProducts")); |
| | |
| | | sum += selectWarehouseReserve.getSelectNum(); |
| | | } |
| | | |
| | | //if (size == 0) { |
| | | //FacesUtils.warn("未选择一个条形码。"); |
| | | //return; |
| | | //} |
| | | this.opeWarehouseReserveService.claim(list, userId,projectNum); |
| | | this.opeWarehouseReserveService.claim(list, userId,projectId,laboratoryId,laboratoryContainerId,receiptNum); |
| | | } |
| | | if(list2.size()>0&&list2!=null){ |
| | | List<OpeApply> opeList=new ArrayList<>(); |
| | | //this.opeApplyService.getOpeApplyList(null,null,null,null,null) |
| | | for(int i=0;i<list2.size();i++){ |
| | | OpeApply opeApply=new OpeApply(); |
| | | opeApply.setArticleNumber(list2.get(i).getArticleNumber()); |
| | | opeApply.setHouseId(laboratoryId); |
| | | opeApply.setContainerId(laboratoryContainerId); |
| | | opeApply.setReagent(this.sysReagentService.getSysReagent(list2.get(i).getReagentId())); |
| | | opeApply.setStartReagentCode(list2.get(i).getStartReagentCode2()); |
| | | opeApply.setEndReagentCode(list2.get(i).getEndReagentCode2()); |
| | | opeList.add(opeApply); |
| | | OpeLaboratoryReserve lr=new OpeLaboratoryReserve(); |
| | | lr.setReagentId(list2.get(i).getReagentId()); |
| | | lr.setHouseId(laboratoryId); |
| | | lr.setContainerId(laboratoryContainerId); |
| | | lr.setReserve(list2.get(i).getSelectNum()); |
| | | lr.setUserId(userId); |
| | | lr.setValidFlag(ValidFlag.VALID); |
| | | this.opeLaboratoryReserveService.insert(lr); |
| | | //opeList.add(this.opeApplyService.getOpeApply(list2.get(i).getId())); |
| | | ApplyListDto lis = new ApplyListDto(); |
| | | Map reagentDetail = sysReagentService.getReagentDetail(list2.get(i).getReagentId()); |
| | | |
| | | lis.setNum(String.valueOf(list2.get(i).getSelectNum())); //数量 |
| | | lis.setMainMetering(String.format("%s%s", reagentDetail.get("main_metering"), reagentDetail.get("unit"))); |
| | | lis.setControlProducts((String) reagentDetail.get("controlProducts")); |
| | | lis.setProductName((String) reagentDetail.get("name")); |
| | | lis.setReagentFormat((String) reagentDetail.get("reagentFormat")); |
| | | lis.setProductCode((String)reagentDetail.get("productCode")); |
| | | lis.setMemo((String)reagentDetail.get("memo")); |
| | | applyList.add(lis); |
| | | |
| | | sum += list2.get(i).getSelectNum(); |
| | | } |
| | | this.opeWarehouseReserveService.reagentDStore2(opeList,userId); |
| | | for(int i=0;i<list2.size();i++){ |
| | | list2.get(i).setReserve(list2.get(i).getReserve()-list2.get(i).getSelectNum()); |
| | | opeWarehouseReserveDao.updateOpeWarehouseReserve(list2.get(i)); |
| | | } |
| | | |
| | | |
| | | //opeWarehouseReserve.setReserve(opeWarehouseReserve.getReserve()-opeWarehouseReserve.getSelectNum()); |
| | | //opeWarehouseReserveDao.updateOpeWarehouseReserve(opeWarehouseReserve); |
| | | //this.opeWarehouseReserveService.claim(list2, userId,projectNum); |
| | | } |
| | | |
| | | //领用票最后一行 |
| | | applyList.add(new ApplyListDto("合计", "", "", "", "", String.valueOf(sum), "")); |
| | |
| | | FacesUtils.info("申领成功。"); |
| | | RequestContext.getCurrentInstance().execute("PF('printDialog').show()"); |
| | | // this.menuController.goToPage(Constants.PAGE_WAREHOUSE_STOCK_MNG, Constants.PAGE_WAREHOUSE_REAGENT_USE_NEW); |
| | | } catch (BusinessException e) { |
| | | logger.error(e.getMessage(), e); |
| | | FacesUtils.warn(e.getMessage()); |
| | | |
| | | } catch (Exception e) { |
| | | logger.error(e.getMessage(), e); |
| | | FacesUtils.warn("操作失败。"); |
| | |
| | | */ |
| | | public void onSaveInputWarehouseClick(){ |
| | | try{ |
| | | //0.0输入校验 |
| | | for (OpeApplyReserve opeApplyReserve : opeApplyList) { |
| | | if (StringUtils.isBlank(opeApplyReserve.getArticleNumber())) { |
| | | throw new BusinessException(ExceptionEnumCode.PARAM_EXIST, opeApplyReserve.getReagent().getName() + ":批号不能为空"); |
| | | } |
| | | SysReagent sysReagent = sysReagentService.getSysReagent(opeApplyReserve.getReagent().getId()); |
| | | if (sysReagent == null){ |
| | | throw new BusinessException(ExceptionEnumCode.PARAM_EXIST, opeApplyReserve.getReagent().getName() + ":被删除"); |
| | | } |
| | | } |
| | | |
| | | //用来检验提交表单得试剂条码是否重复 |
| | | Map<String,Boolean> checkTable= new HashMap<>(); |
| | | if (opeApplyList != null && opeApplyList.size() > 0) { |
| | |
| | | Map<String, Object> filters) { |
| | | List<OpeWarehouseReserve> list = null; |
| | | try { |
| | | int count = opeWarehouseReserveService.getOpeWarehouseReserveTotalCountByName(reagentId, supplierId); |
| | | int count = opeWarehouseReserveService.getOpeWarehouseReserveTotalCountByName(reagentName, supplierId,productSn,warehouseName); |
| | | this.setRowCount(count); |
| | | if (count > 0) { |
| | | list = opeWarehouseReserveService.getOpeWarehouseReserveListByName(reagentId, supplierId, first, |
| | | pageSize); |
| | | list = opeWarehouseReserveService.getOpeWarehouseReserveListByName(reagentName, supplierId, first, |
| | | pageSize,productSn,warehouseName); |
| | | } |
| | | } catch (Exception e) { |
| | | logger.error(e); |
| | | } |
| | | selectedList = null; |
| | | selectedTmpList=null; |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public OpeWarehouseReserve getRowData(String rowKey) { |
| | | Iterator<OpeWarehouseReserve> iterator = this.iterator(); |
| | | if (iterator != null) { |
| | | OpeWarehouseReserve su = null; |
| | | while (iterator.hasNext()) { |
| | | su = iterator.next(); |
| | | if (rowKey.equals(su.getId())) { |
| | | return su; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | // Iterator<OpeWarehouseReserve> iterator = this.iterator(); |
| | | // if (iterator != null) { |
| | | // OpeWarehouseReserve su = null; |
| | | // while (iterator.hasNext()) { |
| | | // su = iterator.next(); |
| | | // if (rowKey.equals(su.getId())) { |
| | | // return su; |
| | | // } |
| | | // } |
| | | // } |
| | | Long id=Long.valueOf(rowKey); |
| | | return opeWarehouseReserveService.getRowData(id); |
| | | } |
| | | }; |
| | | } |
| | |
| | | Map<String, Object> filters) { |
| | | List<OpeApplyReserve> list = null; |
| | | SysUser loginUser = getUser(); |
| | | String id=""; |
| | | if(loginUser.getSeeFlag()==SeeFlag.MANAGE){ |
| | | Long id=null; |
| | | if(loginUser.getSeeFlag()==SeeFlag.MANAGE||loginUser.getSeeFlag() ==SeeFlag.LEADING){ |
| | | |
| | | }else { |
| | | //userName=loginUser.getName(); |
| | |
| | | } |
| | | |
| | | try { |
| | | |
| | | int count = opeApplyService.getOpeApplyReserveTotalCountByNameFor(id,reagentId, userName); |
| | | int count = opeApplyService.getOpeApplyReserveTotalCountByNameFor(id, null, userName, productSn, applyCode, status, isAllApply,isExpired); |
| | | this.setRowCount(count); |
| | | if (count > 0) { |
| | | list = opeApplyService.getOpeApplyReserveListByNameFor(id,reagentId, userName, first, |
| | | pageSize); |
| | | list = opeApplyService.getOpeApplyReserveListByNameFor(id, null, userName, first, |
| | | pageSize, productSn, applyCode, status, isAllApply,isExpired); |
| | | } |
| | | } catch (Exception e) { |
| | | logger.error(e); |
| | | } |
| | | selectedListForPerson = null; |
| | | selectedTmpOrderList=null; |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public OpeApplyReserve getRowData(String rowKey) { |
| | | Iterator<OpeApplyReserve> iterator = this.iterator(); |
| | | if (iterator != null) { |
| | | OpeApplyReserve su = null; |
| | | while (iterator.hasNext()) { |
| | | su = iterator.next(); |
| | | if (rowKey.equals(su.getId())) { |
| | | return su; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | // Iterator<OpeApplyReserve> iterator = this.iterator(); |
| | | // if (iterator != null) { |
| | | // OpeApplyReserve su = null; |
| | | // while (iterator.hasNext()) { |
| | | // su = iterator.next(); |
| | | // if (rowKey.equals(su.getId())) { |
| | | // return su; |
| | | // } |
| | | // } |
| | | // } |
| | | Long id=Long.valueOf(rowKey); |
| | | return opeApplyService.getOpeApplyReserveListByNameForRowData(id); |
| | | } |
| | | }; |
| | | } |
| | |
| | | } |
| | | 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(); |
| | | Long id=null; |
| | | if(loginUser.getSeeFlag()==SeeFlag.MANAGE||loginUser.getSeeFlag() == SeeFlag.LEADING){ |
| | | |
| | | }else { |
| | | //userName=loginUser.getName(); |
| | | id=loginUser.getId(); |
| | | } |
| | | if(selectedListForPerson!=null&&selectedListForPerson.size()>0){ |
| | | realDataList=selectedListForPerson; |
| | | }else { |
| | | realDataList = opeApplyService.getOpeApplyReserveListByNameFor(id,null, userName, null, |
| | | null,productSn,applyCode,status,isAllApply,isExpired); |
| | | } |
| | | 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())+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).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().getProductHome()== null ? "": String.valueOf(dataList.get(i).getReagent().getProductHome())); |
| | | 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).getProjectName()== null ? "": String.valueOf(dataList.get(i).getProjectName())); |
| | | 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; |
| | |
| | | if(selectedList!=null&&selectedList.size()>0){ |
| | | realDataList=selectedList; |
| | | }else { |
| | | realDataList = opeWarehouseReserveService.getOpeWarehouseReserveListByName(reagentId, supplierId, null, |
| | | null); |
| | | realDataList = opeWarehouseReserveService.getOpeWarehouseReserveListByName(reagentName, supplierId, null, |
| | | null,productSn,warehouseName); |
| | | } |
| | | List<String> headerList = new ArrayList<>(); |
| | | headerList.add("试剂名称"); |
| | | headerList.add("产品编号"); |
| | | headerList.add("cas"); |
| | | headerList.add("厂家"); |
| | | headerList.add("供应商"); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | public void onExportOutAndIn(){ |
| | | FacesContext currentInstance = FacesContext.getCurrentInstance(); |
| | | currentInstance.responseComplete(); |
| | | ExternalContext etx = currentInstance.getExternalContext(); |
| | | HttpServletResponse resp = (HttpServletResponse) etx.getResponse(); |
| | | accountInAndOutService.exportExcel(resp); |
| | | } |
| | | |
| | | 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().getProductHome()== null ? "": String.valueOf(dataList.get(i).getReagent().getProductHome())); |
| | | 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(dataList.get(i).getReagent().getReagentFormat())); |
| | | dataRow.createCell(6).setCellValue(dataList.get(i).getReagent().getMainMetering()== null ? "": String.valueOf(dataList.get(i).getReagent().getMainMetering())+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; |
| | |
| | | return; |
| | | } |
| | | |
| | | List<String> selectedIds = new ArrayList<String>(); |
| | | List<Long> selectedIds = new ArrayList<Long>(); |
| | | |
| | | for (OpeApply oa : this.reagentDStoreSelectedList) { |
| | | selectedIds.add(oa.getReagent().getId()); |
| | |
| | | public void onSaveBtnClickNew() { |
| | | |
| | | if (this.reagentDStore.getReagent() == null |
| | | || StringUtils.isBlank(this.reagentDStore.getReagent().getId())) { |
| | | || this.reagentDStore.getReagent().getId()==null) { |
| | | FacesUtils.warn("请选择入库试剂。"); |
| | | RequestContext.getCurrentInstance().execute("PF('reagentDStoreDialog').hide()"); |
| | | return; |
| | |
| | | }*/ |
| | | |
| | | // 检查仓库名 |
| | | if (StringUtils.isBlank(this.reagentDStore.getHouseId())) { |
| | | if (this.reagentDStore.getHouseId()==null) { |
| | | FacesUtils.warn("仓库名不能为空。"); |
| | | return; |
| | | } |
| | | // 检查货柜名 |
| | | if (StringUtils.isBlank(this.reagentDStore.getContainerId())) { |
| | | if (this.reagentDStore.getContainerId()==null) { |
| | | FacesUtils.warn("货柜名不能为空。"); |
| | | return; |
| | | } |
| | | // 检查货柜位置 |
| | | if (StringUtils.isBlank(this.reagentDStore.getPlaceId())) { |
| | | if (this.reagentDStore.getPlace()==null) { |
| | | FacesUtils.warn("货柜位置不能为空。"); |
| | | return; |
| | | } |
| | |
| | | && apply.getEndReagentCode().equals(this.reagentDStore.getEndReagentCode())).count() > 0) { |
| | | FacesUtils.warn("该试剂已被增加!"); |
| | | }else { |
| | | this.reagentDStore.setId(IDUtils.uuid()); |
| | | // this.reagentDStore.setId(IDUtils.uuid()); |
| | | this.reagentDStoreList.add(this.reagentDStore); |
| | | FacesUtils.info("增加成功。"); |
| | | } |
| | |
| | | && apply.getEndReagentCode().equals(this.reagentDStore.getEndReagentCode())).count() > 0) { |
| | | FacesUtils.warn("该试剂已被增加!"); |
| | | }else { |
| | | this.reagentDStore.setId(IDUtils.uuid()); |
| | | // this.reagentDStore.setId(IDUtils.uuid()); |
| | | this.reagentDStoreList.add(this.reagentDStore); |
| | | FacesUtils.info("增加成功。"); |
| | | } |
| | |
| | | this.reagentDStore.setReagent((SysReagent)event.getObject()); |
| | | |
| | | this.reagentDStoreEditFlag = Constants.ACTION_ADD; |
| | | onWarehouseSelectChange(null); |
| | | RequestContext.getCurrentInstance().execute("PF('reagentDStoreDialog').show()"); |
| | | } |
| | | |
| | | public void onWarehouseSelectChange(String warehouseId) { |
| | | public void onWarehouseSelectChange(Long warehouseId) { |
| | | this.warehouseContainerList = null; |
| | | this.warehouseContainerPlaceList = null; |
| | | this.changeWarehouseContainerList(warehouseId); |
| | | this.changeWarehouseContainerPlaceList(null); |
| | | } |
| | | |
| | | private void changeWarehouseContainerList(String warehouseId) { |
| | | if (StringUtils.isBlank(warehouseId)) { |
| | | public void onWarehouseContainerSelectChange(Long warehouseContainerId) { |
| | | this.warehouseContainerPlaceList = null; |
| | | this.changeWarehouseContainerPlaceList(warehouseContainerId); |
| | | } |
| | | |
| | | private void changeWarehouseContainerList(Long warehouseId) { |
| | | if (warehouseId==null) { |
| | | if (this.warehouseList != null && this.warehouseList.size() > 0) { |
| | | warehouseId = this.warehouseList.get(0).getId(); |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(warehouseId)) { |
| | | if (warehouseId!=null) { |
| | | this.warehouseContainerList = warehouseIdContainerMap.get(warehouseId); |
| | | } |
| | | } |
| | | |
| | | private void changeWarehouseContainerPlaceList(String warehouseContainerId) { |
| | | if (StringUtils.isBlank(warehouseContainerId)) { |
| | | private void changeWarehouseContainerPlaceList(Long warehouseContainerId) { |
| | | if (warehouseContainerId==null) { |
| | | if (this.warehouseContainerList != null && this.warehouseContainerList.size() > 0) { |
| | | warehouseContainerId = this.warehouseContainerList.get(0).getId(); |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(warehouseContainerId)) { |
| | | if (warehouseContainerId!=null) { |
| | | SysWarehouseContainer container = this.warehouseContainerMap.get(warehouseContainerId); |
| | | BaseMeta baseMeta = null; |
| | | if (container != null |
| | |
| | | } |
| | | } |
| | | |
| | | public String formatWarehouseName(String id) { |
| | | if (StringUtils.isNotBlank(id) |
| | | && this.warehouseNameMap != null) { |
| | | return warehouseNameMap.get(id); |
| | | } |
| | | |
| | | return ""; |
| | | public String formatWarehouseName(Long id) { |
| | | if(id==null){ |
| | | return ""; |
| | | } |
| | | String name=warehouseNameMap.get(id); |
| | | if(StringUtils.isBlank(name)){ |
| | | SysWarehouse warehouse=this.sysWarehouseService.getSysWarehouse(id); |
| | | if(warehouse!=null){ |
| | | warehouseNameMap.put(warehouse.getId(),warehouse.getName()); |
| | | name=warehouse.getName(); |
| | | } |
| | | } |
| | | return name; |
| | | } |
| | | public String formatWarehouseContainerName(String id) { |
| | | if (StringUtils.isNotBlank(id) |
| | | && this.warehouseContainerMap != null) { |
| | | if (this.warehouseContainerMap.get(id) != null) { |
| | | return this.warehouseContainerMap.get(id).getContainerCode(); |
| | | } |
| | | } |
| | | |
| | | return ""; |
| | | public String formatWarehouseContainerName(Long id) { |
| | | if(id==null){ |
| | | return ""; |
| | | } |
| | | String containerCode=this.warehouseContainerMap.get(id).getContainerCode(); |
| | | if(StringUtils.isBlank(containerCode)){ |
| | | SysWarehouseContainer sysWarehouseContainer = this.sysWarehouseContainerService.getSysWarehouseContainer(id); |
| | | if(sysWarehouseContainer!=null){ |
| | | this.warehouseContainerMap.put(sysWarehouseContainer.getId(),sysWarehouseContainer); |
| | | containerCode=sysWarehouseContainer.getContainerCode(); |
| | | } |
| | | } |
| | | return containerCode; |
| | | } |
| | | public String formatWarehouseContainerPlaceName(String id) { |
| | | if (StringUtils.isNotBlank(id)) { |
| | | public String formatWarehouseContainerPlaceName(Long id) { |
| | | if (id!=null) { |
| | | return this.baseMetaService.getBaseMetaValue(id); |
| | | } |
| | | |
| | |
| | | this.reagentSelectList = reagentSelectList; |
| | | } |
| | | |
| | | public String getReagentId() { |
| | | return reagentId; |
| | | public String getReagentName() { |
| | | return reagentName; |
| | | } |
| | | |
| | | public void setReagentId(String reagentId) { |
| | | this.reagentId = reagentId; |
| | | public void setReagentName(String reagentName) { |
| | | this.reagentName = reagentName; |
| | | } |
| | | |
| | | public List<SysUser> getUserSelectList() { |
| | |
| | | return userSelectList; |
| | | } |
| | | |
| | | public SysUser getSelectedUserById(String userId) { |
| | | public SysUser getSelectedUserById(Long userId) { |
| | | return userSelectList.stream().filter(u->u.getId().equals(userId)).findFirst().get(); |
| | | } |
| | | |
| | |
| | | this.userSelectList = userSelectList; |
| | | } |
| | | |
| | | public String getUserId() { |
| | | public Long getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(String userId) { |
| | | public void setUserId(Long userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | |
| | | public String getProjectNum() { |
| | | return projectNum; |
| | | public Long getProjectId() { |
| | | return projectId; |
| | | } |
| | | |
| | | public void setProjectNum(String projectNum) { |
| | | this.projectNum = projectNum; |
| | | public void setProjectId(Long projectId) { |
| | | this.projectId = projectId; |
| | | } |
| | | |
| | | public String getSupplierId() { |
| | | public Long getSupplierId() { |
| | | return supplierId; |
| | | } |
| | | |
| | | public void setSupplierId(String supplierId) { |
| | | public void setSupplierId(Long supplierId) { |
| | | this.supplierId = supplierId; |
| | | } |
| | | |
| | |
| | | this.reagentCodeSelectedList = reagentCodeSelectedList; |
| | | } |
| | | |
| | | public String getReagentLogId() { |
| | | public Long getReagentLogId() { |
| | | return reagentLogId; |
| | | } |
| | | |
| | | public void setReagentLogId(String reagentLogId) { |
| | | public void setReagentLogId(Long reagentLogId) { |
| | | this.reagentLogId = reagentLogId; |
| | | } |
| | | |
| | | public String getUserLogId() { |
| | | public Long getUserLogId() { |
| | | return userLogId; |
| | | } |
| | | |
| | | public void setUserLogId(String userLogId) { |
| | | public void setUserLogId(Long userLogId) { |
| | | this.userLogId = userLogId; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | public void handleEvent2(){ |
| | | System.out.println("==============================="); |
| | | if(useNum!=null && useNum>0){ |
| | | if(startReagentCode!=null && !startReagentCode.equals("")){ |
| | | if (startReagentCode.matches(".*\\D+.*")) { |
| | | if (startReagentCode.length() ==24 && |
| | | startReagentCode.matches(".*([A-F]|\\d)+.*") && |
| | | startReagentCode.substring(startReagentCode.length() - 5).matches("\\d{5}")){ |
| | | |
| | | BigDecimal start=new BigDecimal(startReagentCode.trim()); |
| | | String str=startReagentCode; |
| | | String up=""; |
| | | int len = startReagentCode.length() - String.valueOf(start).length(); |
| | | String temp = ""; |
| | | for (int i = 0; i < len; i++) { |
| | | temp += "0"; |
| | | //2.2长度为24位编码的 |
| | | BigInteger arrNum = BigInteger.valueOf((long)useNum); |
| | | //后5位随机码 |
| | | String randomCode = startReagentCode.substring(startReagentCode.length() - 5); |
| | | String reagentCodePrefix = startReagentCode.substring(0,startReagentCode.length() - 5); |
| | | |
| | | BigInteger startReagentCodeSuffix = new BigInteger(randomCode); |
| | | BigInteger endReagentCodeSuffix = startReagentCodeSuffix.add(arrNum).subtract((new BigInteger("1"))); |
| | | String reagentCodeSuffix= autoGenericCode(randomCode, endReagentCodeSuffix); |
| | | endReagentCode= (reagentCodePrefix + reagentCodeSuffix); |
| | | }else{ |
| | | endReagentCode = (""); |
| | | } |
| | | }else{ |
| | | |
| | | BigInteger startReagentCode2 = new BigInteger(startReagentCode); |
| | | //2.1长度不为24位编码 |
| | | //数据1 |
| | | BigInteger arrNum = BigInteger.valueOf((long)useNum); |
| | | BigInteger code1 = startReagentCode2.add(arrNum).subtract(BigInteger.ONE); |
| | | endReagentCode=(autoGenericCode(startReagentCode, code1)); |
| | | } |
| | | BigDecimal end = start.add(new BigDecimal(useNum-1)); |
| | | endReagentCode=temp+end.toString(); |
| | | //endReagentCode=Integer.toString(useNum-1+Integer.parseInt(startReagentCode)); |
| | | }else{ |
| | | FacesUtils.info("请输入条形码开始"); |
| | | } |
| | | }else { |
| | | FacesUtils.info("请输入领用数量"); |
| | | } |
| | | } |
| | | |
| | | public void clearStartAndEndCode(){ |
| | | endReagentCode = ""; |
| | | } |
| | | |
| | | public void handleEventForPerson(){ |
| | |
| | | list.add(sysUser); |
| | | applyUserSelectList = list; |
| | | } else { |
| | | applyUserSelectList = this.sysUserService.getSysUserList(null, null, null, null, null); |
| | | applyUserSelectList = this.sysUserService.getSysUserList(null, null, null, null, null,null,null); |
| | | } |
| | | } |
| | | return applyUserSelectList; |
| | |
| | | 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); |
| | |
| | | |
| | | @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; |
| | | // } |
| | | // } |
| | | // } |
| | | Long id=Long.valueOf(rowKey); |
| | | return sysReagentService.getSysReagentListNewRowData(id); |
| | | } |
| | | }; |
| | | } |
| | |
| | | this.useNum = useNum; |
| | | } |
| | | |
| | | public String getOriLaboratoryId() { |
| | | public Long getOriLaboratoryId() { |
| | | return oriLaboratoryId; |
| | | } |
| | | |
| | | public void setOriLaboratoryId(String oriLaboratoryId) { |
| | | public void setOriLaboratoryId(Long oriLaboratoryId) { |
| | | this.oriLaboratoryId = oriLaboratoryId; |
| | | } |
| | | |
| | | public void resetLaboratory(){ |
| | | laboratory = null; |
| | | laboratoryId = null; |
| | | laboratoryContainers = null; |
| | | //getLaboratory(); |
| | | //getLaboratoryContainers(); |
| | | } |
| | | |
| | | // public void setContainerId(){ |
| | | // } |
| | | public void resetLaboratoryContainers() { |
| | | laboratoryContainers = null; |
| | | //getLaboratoryContainers(); |
| | | } |
| | | public List<SysLaboratory> getLaboratory() { |
| | | if(userId != null && userId.trim().length() > 0) |
| | | if(userId != null) |
| | | { |
| | | this.laboratory = this.sysLaboratoryService.getSysLaboratoryListByDep(sysUserService.getSysUser(userId).getDepartment()); |
| | | |
| | | //Todo 修改申领人的实验室显示信息 |
| | | this.laboratory = this.sysLaboratoryService.getSysLaboratoryListByUserId(userId); |
| | | if(this.laboratory != null && this.laboratory.size() > 0) |
| | | { |
| | | //flag =true; |
| | | //if(laboratoryId != null && laboratoryId.trim().length() > 0) |
| | | //{ |
| | | // this.oriLaboratoryId = this.laboratoryId; |
| | | //}else |
| | | //{ |
| | | // this.oriLaboratoryId = this.laboratory.get(0).getId(); |
| | | //} |
| | | this.laboratoryId=this.laboratory.get(0).getId(); |
| | | this.laboratoryContainers = this.sysLaboratoryContainerService.getSysLaboratoryContainerList(this.laboratory.get(0).getId()); |
| | | if(laboratoryId != null) |
| | | { |
| | | this.oriLaboratoryId = this.laboratoryId; |
| | | }else |
| | | { |
| | | this.laboratoryId = this.laboratory.get(0).getId(); |
| | | } |
| | | |
| | | // this.laboratoryId = this.laboratory.get(0).getId(); |
| | | this.laboratoryContainers = this.sysLaboratoryContainerService.getSysLaboratoryContainerList(laboratoryId); |
| | | }else { |
| | | this.oriLaboratoryId = null; |
| | | this.laboratoryContainers = null; |
| | |
| | | } |
| | | |
| | | public List<SysLaboratoryContainer> getLaboratoryContainers() { |
| | | if(laboratoryId != null && laboratoryId.trim().length() > 0) |
| | | if(laboratoryId != null) |
| | | { |
| | | this.laboratoryContainers = this.sysLaboratoryContainerService.getSysLaboratoryContainerList(laboratoryId); |
| | | } |
| | |
| | | this.laboratoryContainers = laboratoryContainers; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | |
| | | this.arrivalTime = arrivalTime; |
| | | } |
| | | |
| | | public String getConsigneeId() { |
| | | public Long getConsigneeId() { |
| | | return consigneeId; |
| | | } |
| | | |
| | | public void setConsigneeId(String consigneeId) { |
| | | public void setConsigneeId(Long consigneeId) { |
| | | this.consigneeId = consigneeId; |
| | | } |
| | | |
| | | public List getConsignee() { |
| | | List<SysUser> dataList = this.sysUserService.getSysUserList(null, null, null, null, null); |
| | | List<SysUser> dataList = this.sysUserService.getSysUserList(null, null, null, null, null,null,null); |
| | | //将admin置于首位 |
| | | for (int i = 0; i < dataList.size(); i++) { |
| | | if ("admin".equals(dataList.get(i).getAccount())){ |
| | |
| | | } |
| | | //2如果开始条码不为空 |
| | | //2.0如果包含字母不等于24位的直接不管 |
| | | if (startReagentCode2.matches(".*[A-F]+.*")) { |
| | | if (startReagentCode2.length() ==24){ |
| | | |
| | | if (startReagentCode2.matches(".*\\D+.*")) { |
| | | if (startReagentCode2.length() ==24 && |
| | | startReagentCode2.matches(".*([A-F]|\\d)+.*") && |
| | | startReagentCode2.substring(startReagentCode2.length() - 5).matches("\\d{5}")){ |
| | | //2.2长度为24位编码的 |
| | | BigInteger arrNum = BigInteger.valueOf(oar.getArrivalNum().longValue()); |
| | | //后5位随机码 |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | 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; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public List<OpeWarehouseReserve> getWarehouseReserveList() { |
| | | return warehouseReserveList; |
| | | } |
| | | |
| | | public void setWarehouseReserveList(List<OpeWarehouseReserve> warehouseReserveList) { |
| | | this.warehouseReserveList = warehouseReserveList; |
| | | } |
| | | |
| | | public OpeWarehouseReserve getOpeWarehouseReserve() { |
| | | return opeWarehouseReserve; |
| | | } |
| | | |
| | | public void setOpeWarehouseReserve(OpeWarehouseReserve opeWarehouseReserve) { |
| | | this.opeWarehouseReserve = opeWarehouseReserve; |
| | | } |
| | | |
| | | public String getReceiptNumber() { |
| | | return receiptNumber; |
| | | } |
| | | |
| | | public void setReceiptNumber(String receiptNumber) { |
| | | this.receiptNumber = receiptNumber; |
| | | } |
| | | |
| | | public String getWarehouseName() { |
| | | return warehouseName; |
| | | } |
| | | |
| | | public void setWarehouseName(String warehouseName) { |
| | | this.warehouseName = warehouseName; |
| | | } |
| | | |
| | | public Integer getIsAllApply() { |
| | | return isAllApply; |
| | | } |
| | | |
| | | public void setIsAllApply(Integer isAllApply) { |
| | | this.isAllApply = isAllApply; |
| | | } |
| | | |
| | | public boolean getIsExpired() { |
| | | return isExpired; |
| | | } |
| | | |
| | | public void setIsExpired(boolean isExpired) { |
| | | this.isExpired = isExpired; |
| | | } |
| | | |
| | | //过期处理 |
| | | public void expireOrder() { |
| | | //1.判断当前订单是否是已入库的状态 |
| | | if (this.selectedListForPerson.size() < 1) { |
| | | FacesUtils.warn("请选择数据。"); |
| | | return; |
| | | } |
| | | ArrayList<Long> ids = new ArrayList<>(); |
| | | for (OpeApplyReserve oa : this.selectedListForPerson) { |
| | | ids.add(oa.getId()); |
| | | if (oa.getStatus() != ApplyStatus.SUPPLIER_CONFIRM) { |
| | | FacesUtils.warn("只能让已确认状态的单子过期。"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | opeApplyService.updateOpeApplyStatus(ApplyStatus.EXPIRED, null, ids); |
| | | FacesUtils.warn("操作成功。"); |
| | | |
| | | |
| | | } |
| | | |
| | | public void recoverOrder(){ |
| | | if (this.selectedListForPerson.size() < 1) { |
| | | FacesUtils.warn("请选择数据。"); |
| | | return; |
| | | } |
| | | ArrayList<Long> ids = new ArrayList<>(); |
| | | for (OpeApplyReserve oa : this.selectedListForPerson) { |
| | | ids.add(oa.getId()); |
| | | if (oa.getStatus() != ApplyStatus.EXPIRED) { |
| | | FacesUtils.warn("只能让过期单子恢复确认。"); |
| | | return; |
| | | } |
| | | } |
| | | opeApplyService.updateOpeApplyStatus(ApplyStatus.SUPPLIER_CONFIRM, null, ids); |
| | | FacesUtils.warn("操作成功。"); |
| | | } |
| | | |
| | | public String getNote() { |
| | | return note; |
| | | } |
| | | |
| | | public void setNote(String note) { |
| | | this.note = note; |
| | | } |
| | | } |