/**
   * 查询许可证明细
   *
   * @param ticket
   * @param pageParams
   * @param queryParams
   * @return
   */
  public FWResult queryPageMSWMBaseLicLine(
      String ticket, Map<String, Object> pageParams, Map<String, Object> queryParams) {
    FWResult<BaseData<BaseLicLineEntity>> fwResult = new FWResult<BaseData<BaseLicLineEntity>>();
    BaseData<BaseLicLineEntity> data = new BaseData<BaseLicLineEntity>();
    try {
      IFWUserInfo userInfo = getUserInfo();

      BaseLicLineEntity param = new BaseLicLineEntity();

      String basematclassclasscode = (String) queryParams.get("basematclassclasscode");
      if (PublicMethod.isNotEmptyOrNull(basematclassclasscode)) {
        param.setBasematclassclasscode(basematclassclasscode);
      }

      String basematclassclassname = (String) queryParams.get("basematclassclassname");
      if (PublicMethod.isNotEmptyOrNull(basematclassclassname)) {
        param.setBasematclassclassname(basematclassclassname);
      }

      String basematerialmatname = (String) queryParams.get("basematerialmatname");
      if (PublicMethod.isNotEmptyOrNull(basematerialmatname)) {
        param.setBasematerialmatname(basematerialmatname);
      }

      if (queryParams.get("qty") != null && !String.valueOf(queryParams.get("qty")).equals("")) {
        param.setQty(Double.parseDouble(queryParams.get("qty").toString()));
      }

      String basedealtypename = (String) queryParams.get("basedealtypename");
      if (PublicMethod.isNotEmptyOrNull(basedealtypename)) {
        param.setBasedealtypename(basedealtypename);
      }

      int pageIndex =
          Double.valueOf(pageParams.get("pageIndex").toString().replace(" ", "")).intValue();
      int pageSize =
          Double.valueOf(pageParams.get("pageSize").toString().replace(" ", "")).intValue();
      int count = baseLicLineService.countPageBaseLicLine(userInfo, param);
      FWPage fwPage = param.getPage();
      fwPage.setPageSize(pageSize);
      fwPage.setCurrentPageNum(pageIndex);
      fwPage.setTotalRecords(count);
      fwPage.processPageBean();
      data.setPageIndex(fwPage.getCurrentPageNum());
      data.setRecordCount(fwPage.getTotalRecords());
      data.setPageSize(fwPage.getPageSize());

      List<BaseLicLineEntity> baseEmpList =
          baseLicLineService.queryPageBaseLicLineByPage(userInfo, param);
      data.setEntityList(baseEmpList);
      fwResult.setData(data);
      fwResult.setStatus(FWResultStatus.Success); // 查询成功
      return fwResult;

    } catch (Exception e) {
      logger.error("查询失败", e);
      fwResult.setStatus(FWResultStatus.Error); // 查询失败
      return fwResult;
    }
  }
  /**
   * 保存许可证明细
   *
   * @param ticket
   * @param baseLicLineEntity
   * @return
   */
  public FWResult saveMSWMBaseLicLineEntity(String ticket, BaseLicLineEntity baseLicLineEntity) {
    FWResult result = new FWResult();
    try {
      IFWUserInfo userInfo = getUserInfo();

      if (PublicMethod.isNotEmptyOrNull(baseLicLineEntity.getGuid())) {
        baseLicLineService.updateMSWMBaseLicLine(userInfo, baseLicLineEntity);
      } else {
        baseLicLineEntity.setGuid(PublicMethod.getUUID());
        baseLicLineService.saveMSWMBaseLicLine(userInfo, baseLicLineEntity);
      }
    } catch (Exception e) {
      logger.error("操作失败", e);
      result.setStatus(FWResultStatus.Error); // 失败
      return result;
    }
    result.setStatus(FWResultStatus.Success);
    return result;
  }
  /**
   * 查询许可证子表,根据许可证主表ID
   *
   * @param ticket
   * @param pageParams
   * @param queryParams
   * @return
   */
  public FWResult queryPageMSWMBaseLicLineByHeadID(
      String ticket, Map<String, Object> pageParams, Map<String, Object> queryParams) {
    FWResult<BaseData<BaseLicLineEntity>> fwResult = new FWResult<BaseData<BaseLicLineEntity>>();
    BaseData<BaseLicLineEntity> data = new BaseData<BaseLicLineEntity>();
    try {
      IFWUserInfo userInfo = getUserInfo();

      BaseLicLineEntity param = new BaseLicLineEntity();

      String headID = (String) queryParams.get("headID");
      if (PublicMethod.isNotEmptyOrNull(headID)) {
        param.setHeadID(headID);
      }

      int pageIndex =
          Double.valueOf(pageParams.get("pageIndex").toString().replace(" ", "")).intValue();
      int pageSize =
          Double.valueOf(pageParams.get("pageSize").toString().replace(" ", "")).intValue();
      int count = baseLicLineService.countBaseLicLineByHeadId(userInfo, param);

      FWPage fwPage = param.getPage();
      fwPage.setPageSize(pageSize);
      fwPage.setCurrentPageNum(pageIndex);
      fwPage.setTotalRecords(count);
      fwPage.processPageBean();
      data.setPageIndex(fwPage.getCurrentPageNum());
      data.setRecordCount(fwPage.getTotalRecords());
      data.setPageSize(fwPage.getPageSize());

      List<BaseLicLineEntity> baseEmpList =
          baseLicLineService.getBaseLicLineByHeadIdByPage(userInfo, param);
      data.setEntityList(baseEmpList);
      fwResult.setData(data);
      fwResult.setStatus(FWResultStatus.Success); // 查询成功
      return fwResult;

    } catch (Exception e) {
      logger.error("查询失败", e);
      fwResult.setStatus(FWResultStatus.Error); // 查询失败
      return fwResult;
    }
  }
  /**
   * 根据ID删除许可证明细
   *
   * @param ticket
   * @param ids
   * @return
   */
  public FWResult delMSWMBaseLicLineByIDs(String ticket, List<String> ids) {
    FWResult<BaseLicLineEntity> fwResult = new FWResult<BaseLicLineEntity>();
    try {
      IFWUserInfo userInfo = getUserInfo();

      baseLicLineService.delMSWMBaseLicLine(userInfo, ids); // 删除
      fwResult.setStatus(FWResultStatus.Success);
      return fwResult;
    } catch (Exception e) {
      logger.error("删除失败", e);
      fwResult.setStatus(FWResultStatus.Error);
      return fwResult;
    }
  }
  /**
   * 根据ID查询许可证明细
   *
   * @param ticket
   * @param id
   * @return
   */
  public FWResult queryMSWMBaseLicLineByID(String ticket, String id) {
    FWResult<BaseLicLineEntity> fwResult = new FWResult<BaseLicLineEntity>();
    try {
      IFWUserInfo userInfo = getUserInfo();

      BaseLicLineEntity baseEmp = baseLicLineService.queryMSWMBaseLicLineById(userInfo, id); // 查询
      fwResult.setData(baseEmp);
      fwResult.setStatus(FWResultStatus.Success);
      return fwResult;
    } catch (Exception e) {
      logger.error("查询失败失败", e);
      fwResult.setStatus(FWResultStatus.Error);
      return fwResult;
    }
  }