public ZcPProMakeXMEditPanel(
      GkBaseDialog parent, ListCursor listCursor, String tabStatus, ZcPProMakeListPanel listPanel) {

    super(parent, listCursor, tabStatus, listPanel);

    ZcPProMake make = (ZcPProMake) listCursor.getCurrentObject();

    if (make.getZcMakeStatus().equals("0")
        && make.getProcessInstId() != null
        && make.getProcessInstId().longValue() > 0) {

      sendButton.setEnabled(true);

      deleteButton.setEnabled(true);
    }
    if (make.getZcMakeStatus().equals("0") && make.getProcessInstId() == null) {

      deleteButton.setEnabled(false);
      sendButton.setEnabled(true);
    }
    //    if (make.getZcMakeStatus().equals("0") || (saveButton.isVisible() &&
    // deleteButton.isVisible())) {
    //
    //      updateWFSubTableEditable(true);
    //
    //    } else {
    //
    //      updateWFSubTableEditable(false);
    //
    //    }
    //    if ("40".equals(make.getZcMakeStatus()) && this.suggestPassButton.isVisible()) {
    //            setWFSubTableEditable(this.itemTablePanel, true);
    //    }

    if ("N".equals(make.getZcIsImp())) {

      zcImpFile.setEnabled(false);
    }
  }
  public void doSuggestPass() {
    ZcPProMake make = (ZcPProMake) ObjectUtil.deepCopy(this.listCursor.getCurrentObject());
    if (listPanel.checkBeforeSave(make, self)) {
      return;
    }
    if (isDataChanged()) {

      JOptionPane.showMessageDialog(this, "数据发生改变,请先保存.", "提示", JOptionPane.INFORMATION_MESSAGE);
      return;
    }
    BaseRule rule = getZcMakeCheckRule();

    Map parameter = new HashMap();

    parameter.put("data", make);

    // 填报提示信息

    Map resMap = rule.check(parameter);

    String resInfo = (String) resMap.get("resInfo");

    int num = JOptionPane.YES_OPTION;

    if (resInfo != null && resInfo.length() > 0) {

      num = JOptionPane.showConfirmDialog(this, resInfo, "提示", 0);
    }

    if (num == JOptionPane.YES_OPTION) {

      //      nd = ((AsValComboBox) zcPitemOpiway.getField()).getSelectedAsVal().getVal();

      pf = ((AsValComboBox) zcPifuCgfs.getField()).getSelectedAsVal().getVal();

      //      repaint();

      ZcPProMake afterSaveBill = null;

      GkCommentDialog commentDialog =
          new GkCommentDialog(
              DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(),
              ModalityType.APPLICATION_MODAL);

      if (commentDialog.cancel) {

        return;
      }

      boolean success = true;

      String errorInfo = "";

      try {

        requestMeta.setFuncId(this.suggestPassButton.getFuncId());

        make.setComment(commentDialog.getComment());

        make.setZcAttr1("N");

        make.setAuditorId(WorkEnv.getInstance().getCurrUserId());

        afterSaveBill = listPanel.getZcPProMakeServiceDelegate().auditFN(make, requestMeta);

      } catch (Exception e) {

        success = false;

        logger.error(e.getMessage(), e);

        errorInfo += e.getMessage();
      }

      if (success) {

        this.refreshAll(afterSaveBill, true);

        JOptionPane.showMessageDialog(this, "审核成功!", "提示", JOptionPane.INFORMATION_MESSAGE);

        this.listPanel.refreshCurrentTabData();

      } else {

        JOptionPane.showMessageDialog(this, "审核失败 !" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);
      }

      /*  if (!(pf.equals(nd))) {

        GkCommentDialog commentDialog = new GkCommentDialog(DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(),

        ModalityType.APPLICATION_MODAL, "同意" + "\n" + "采购单位申请的采购方式为" + nd + "\n" + "经审核,批复为" + pf + "方式");

        if (commentDialog.cancel) {

          return;

        }

        boolean success = true;

        ZcPProMake afterSaveBill = null;

        String errorInfo = "";

        try {

          requestMeta.setFuncId(this.suggestPassButton.getFuncId());

          make.setComment(commentDialog.getComment());

          make.setZcAttr1("N");

          make.setAuditorId(WorkEnv.getInstance().getCurrUserId());

          afterSaveBill = listPanel.getZcPProMakeServiceDelegate().auditFN(make, requestMeta);

        } catch (Exception e) {

          success = false;

          logger.error(e.getMessage(), e);

          errorInfo += e.getMessage();

        }

        if (success) {

          this.refreshAll(afterSaveBill, true);

          JOptionPane.showMessageDialog(this, "审核成功!", "提示", JOptionPane.INFORMATION_MESSAGE);

          this.listPanel.refreshCurrentTabData();

        } else {

          JOptionPane.showMessageDialog(this, "审核失败 !" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);

        }

      }*/

    }
  }
  protected void refreshData() { // add shijia 20111105

    ZcPProMake zcPProMake = (ZcPProMake) listCursor.getCurrentObject();

    boolean isNew;

    if (zcPProMake != null) {

      isNew = false;

      zcPProMake =
          getZcPProMakeServiceDelegate()
              .selectByPrimaryKey(zcPProMake.getZcMakeCode(), this.requestMeta);

      fukuanValId = zcPProMake.getZcMakeSequence();
      List biList =
          getZcPProMakeServiceDelegate()
              .getZcPProMitemBi(zcPProMake.getZcMakeCode(), ZcUtil.useBudget(), requestMeta);
      zcPProMake.setBiList(biList);

      listCursor.setCurrentObject(zcPProMake);

      if (biList != null && biList.size() > 0) {
        if (ZcUtil.useBudget()) {
          String sumId = "";
          for (int i = 0; i < biList.size(); i++) {
            ZcPProMitemBi bi = (ZcPProMitemBi) biList.get(i);
            if ("A".equals(bi.getPaytypeCode())) {
              bi.setZcBiPayType("2");
              bi.setZcBiDoSum(null);
              continue;
            }
            bi.setZcBiPayType("1");
            if (sumId.length() > 0) {
              sumId = sumId + ",'" + bi.getZcBiNo() + "'";
            } else {
              sumId = "'" + bi.getZcBiNo() + "'";
            }
          }
          getDto.setZcText3(sumId);
        }
      }
      if (ZcUtil.useBudget()) {
        getDto.setZcMakeCode(zcPProMake.getZcMakeCode());
      }

    } else {

      isNew = true;

      zcPProMake = new ZcPProMake();

      setDeftValue(zcPProMake);

      zcPProMake.setCoCode(this.requestMeta.getSvCoCode());

      initOrg(zcPProMake);

      zcPProMake.setNd(this.requestMeta.getSvNd());

      zcPProMake.setBiList(new ArrayList());

      zcPProMake.setItemList(new ArrayList());
      zcPProMake.setZcInputDate(this.requestMeta.getSysDate());

      // 新增数据默认插入一行

      ZcPProMitem item = new ZcPProMitem();

      setItemDefaultValue(item);

      zcPProMake.getItemList().add(item);

      ZcPProMitemBi bi = new ZcPProMitemBi();

      setItemBiDefaultValue(bi);

      zcPProMake.getBiList().add(bi);

      listCursor.getDataList().add(zcPProMake);

      listCursor.setCurrentObject(zcPProMake);
    }
    if (ZcUtil.useBudget()) {
      getDto.setNd(requestMeta.getSvNd());
      getDto.setZcText2("1");
      getDto.setCoCode(
          zcPProMake.getCoCode() != null ? zcPProMake.getCoCode() : requestMeta.getSvCoCode());
    }

    this.setEditingObject(zcPProMake);

    if (zcPProMake.getProcessInstId() != null && zcPProMake.getProcessInstId().longValue() > 0) {

      // 工作流的单据

      wfCanEditFieldMap = BillElementMeta.getWfCanEditField(zcPProMake, requestMeta);
    }

    itemTablePanel.setTableModel(
        new ZcPProMakeToTableModelConverter()
            .convertSubItemTableData(zcPProMake.getItemList(), getItemInfo(), wfCanEditFieldMap));

    if (ZcUtil.useBudget()) {
      biTablePanel.setTableModel(
          ZcPProMakeToTableModelConverter.convertSubBiTableData(
              zcPProMake.getBiList(), wfCanEditFieldMap));
    } else {
      biTablePanel.setTableModel(
          ZcPProMakeToTableModelConverter.convertSubBiTableDataWithOutBudget(
              zcPProMake.getBiList(), wfCanEditFieldMap));
    }

    // 刷新竞价信息和成交信息

    refreshJinJiaChengJiao();

    // 翻译从表表头列

    ZcUtil.translateColName(itemTablePanel.getTable(), getItemInfo());

    if (ZcUtil.useBudget()) {
      ZcUtil.translateColName(biTablePanel.getTable(), ZcPProMakeToTableModelConverter.biInfo);
    } else {
      ZcUtil.translateColName(biTablePanel.getTable(), ZcPProMakeToTableModelConverter.biInfo2);
    }

    // 设置从表列类型

    setTableBiEditor(biTablePanel.getTable());

    setTableItemEditor(itemTablePanel.getTable());

    // 设置从表监听

    addBiTableLisenter(biTablePanel.getTable());

    addItemTableLisenter(itemTablePanel.getTable());

    setOldObject();

    // 根据工作流模版设置功能按钮是否可用

    setButtonStatus(zcPProMake, requestMeta, this.listCursor);

    // 根据工作流模版设置字段是否可编辑

    updateWFEditorEditable(zcPProMake, requestMeta);

    this.fitTable();

    // 草稿状态设置【批复采购方式】只读

    if ("0".equals(zcPProMake.getZcMakeStatus())
        || (saveButton.isVisible() && deleteButton.isVisible())) {

      if (zcPifuCgfs != null) {

        zcPifuCgfs.setEnabled(true);
      }
      if (zcMakePfSequence != null) {
        zcMakePfSequence.setEnabled(false);
      }
    }

    if (isNew) {

      biTablePanel.getTable().setRowSelectionInterval(0, 0);

      itemTablePanel.getTable().setRowSelectionInterval(0, 0);
    }

    if (zcPProMake.getZcMakeStatus().equals("0")
        && zcPProMake.getProcessInstId() != null
        && zcPProMake.getProcessInstId().longValue() > 0) {

      sendButton.setEnabled(false);

    } else if (zcPProMake.getZcMakeStatus().equals("0")
        && zcPProMake.getProcessInstId() != null
        && zcPProMake.getProcessInstId().longValue() < 0) {

      sendButton.setEnabled(true);

    } else if (zcPProMake.getZcMakeStatus().equals("0") && zcPProMake.getProcessInstId() != null) {

      sendButton.setEnabled(true);
    }

    //    if (zcPProMake.getZcMakeStatus().equals("0") || (saveButton.isVisible() &&
    // deleteButton.isVisible())) {
    //
    //      updateWFSubTableEditable(true);
    //
    //    } else {
    //
    //      updateWFSubTableEditable(false);
    //
    //    }

    // 退回状态时,明细都可以编辑 add shijia 20111105

    if (zcPProMake.getZcMakeStatus().equals(ZcSettingConstants.WF_STATUS_DRAFT)
        && WorkEnv.getInstance().containRole(ZcSettingConstants.ROLE_YSDWJB)) {

      String valId = ((AsValComboBox) zcPitemOpiway.getField()).getSelectedAsVal().getValId();

      valId = ((AsValComboBox) zcIsImp.getField()).getSelectedAsVal().getValId();

      if ("N".equals(valId)) { // 当是否涉及进出口选择否的时候,将附件上传设置为不可用,如果是从“是”跳转回来的话,要将上传的附件从数据库中删除

        zcImpFile.setEnabled(false);
      } else {
        zcImpFile.setEnabled(true);
      }
    }

    // end add

    biTabPane.repaint();

    itemTabPane.repaint();
  }
package com.ufgov.zc.client.zc.zcebxy;