Exemplo n.º 1
0
  @Override
  public List<AbstractFieldEditor> createFieldEditors() {
    if (fieldEditors != null && fieldEditors.size() > 0) {
      return fieldEditors;
    }

    List<AbstractFieldEditor> editorList = new ArrayList<AbstractFieldEditor>();

    AutoNumFieldEditor zcMakeCode =
        new AutoNumFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_MAKE_CODE), "zcMakeCode");
    TextFieldEditor zcMakeName =
        new TextFilePathFieldEditor(
            LangTransMeta.translate(FIELD_TRANS_ZC_MAKE_NAME), "zcMakeName");
    AsValFieldEditor zcMakeStatus =
        new AsValFieldEditor(
            LangTransMeta.translate(FIELD_TRANS_ZC_MAKE_STATUS),
            "zcMakeStatus",
            "ZC_VS_MAKE_STATUS");
    IForeignEntityTreeHandler companyHandler =
        new IForeignEntityTreeHandler() {

          @Override
          public void excute(List selectedDatas) {

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

            if (selectedDatas != null && selectedDatas.size() > 0) {

              Company company = (Company) selectedDatas.get(0);

              zcPProMake.setOrgCode(company.getForgCode());

              setEditingObject(zcPProMake);
            }
          }

          @Override
          public boolean isMultipleSelect() {

            return false;
          }

          @Override
          public boolean isSelectLeaf() {

            return false;
          }
        };

    CompanyFieldEditor zcCoCode =
        new CompanyFieldEditor(
            LangTransMeta.translate(FIELD_TRANS_ZC_CO_NAME),
            "coCode",
            companyHandler,
            getCompoId(),
            "CO_CODE");

    zcCoCode.setEnabled(false);

    TextFieldEditor zcCoCodeNd =
        new TextFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_CO_CODE_ND), "nd");

    zcCoCodeNd.setEnabled(false);

    OrgFieldEditor zcZgCsCode =
        new OrgFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_ZG_CS_CODE), "orgCode", false);

    TextFieldEditor zcMakeLinkman =
        new TextFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_MAKE_LINKMAN), "zcMakeLinkman");

    TextFieldEditor zcMakeTel =
        new TextFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_MAKE_TEL), "zcMakeTel");

    TextFieldEditor zcAttr2 =
        new TextFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_ATTR2), "zcAttr2");

    zcMoneyBiSum =
        new MoneyFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_MONEY_BI_SUM), "zcMoneyBiSum");

    zcMoneyBiSum.setEnabled(false);

    // 委托机构名称,从后面提到前面进行声明

    String columNames[] = {"代理机构代码", "代理机构名称"};

    ZcAgeyFnHandler handler = new ZcAgeyFnHandler(columNames);

    ElementConditionDto elementCondtiontDto = new ElementConditionDto();

    elementCondtiontDto.setBillStatus("1");

    zcAgeyCode =
        new ForeignEntityFieldEditor(
            "ZC_B_AGENCY.getZcBAgencyWithFN",
            elementCondtiontDto,
            20,
            handler,
            columNames,
            LangTransMeta.translate(FIELD_TRANS_ZC_TRUST_AGEY_CODE),
            "zcAgeyCode") {

          public static final long serialVersionUID = -7737549222488261602L;

          @Override
          public void setValue(Object value) {

            //        ZcPProMake make = ((ZcPProMake) value);

            //        Updated By FengYan 2011-08-04

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

            //        if (make.getZcMakeCode() != null) {

            //          make =
            // getZcPProMakeServiceDelegate().selectByPrimaryKey(make.getZcMakeCode(), requestMeta);

            //        }

            if (make.getAgency() == null) {

              field.setText(null);

              field.setToolTipText(null);

            } else {

              field.setText(make.getAgencyName());

              field.setToolTipText("[" + make.getAgency() + "]" + make.getAgencyName());
            }
          }

          @Override
          public Object getValue() {

            return this.field.getText();
          }
        };

    // 申请采购组织形式 (1集中采购,2部门集中采购,3分散采购)

    zcMakeSequence =
        new AsValFieldEditor(
            LangTransMeta.translate(FIELD_TRANS_ZC_MAKE_SEQUENCE),
            "zcMakePfSequence",
            "VS_ZC_ORGTYPE") {

          public void setValue(Object value) {
            super.setValue(value);
          }

          int i = 0; // add by wangkewei,用于判断是不是第一次调用afterChange

          protected void afterChange(AsValComboBox field) {
            if (field.getSelectedAsVal() == null) {
              return;
            }

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

            if (beanData.getProcessInstId() == null || beanData.getZcMakeStatus().equals("0")) {

              String valId = field.getSelectedAsVal().getValId();

              // 采购组织形式和采购方式的联动

              if (valId.equals("1")) { // 采购组织形式和委托机构名称联动 :政府集中采购必须为采购中心,不可修改,不可改变

                haveInitFlag = false;

                beanData.setAgencyName(AsOptionMeta.getOptVal("OPT_ZC_CGZX_NAME"));

                beanData.setAgency(AsOptionMeta.getOptVal("OPT_ZC_CGZX_CODE"));

                //          zcAgeyCode.setEditable(false);

                zcAgeyCode.setEnabled(false); // wangkewei

                zcPitemOpiway.setEnabled(true);

                setEditingObject(beanData);

                haveInitFlag = true;

                valSetId = "1";

                fukuanValId = "1";

                i++;

              } else if (valId.equals("2")) {

                haveInitFlag = false;

                // 判断是采购组织形式选项是否有变化,有变化则清空委托机构名称

                if (!valId.equals(valSetId) && i > 0) { // 如果不是第一次调用,将委托机构名称设置为空,如果是第一次调用,界面上显示数据库的值

                  if (!fukuanValId.equals(valId) && beanData.getZcMakeStatus().equals("0")) {

                    beanData.setAgencyName("");

                    beanData.setAgency("");
                  }
                }

                valSetId = "2";

                fukuanValId = "2";

                // beanData.setZcPifuCgfs(null);

                // beanData.setZcPitemOpiway(null);

                // zcPifuCgfs.setEnabled(false);

                zcPitemOpiway.setEnabled(true);

                zcAgeyCode.setEnabled(true);

                zcAgeyCode.setEditable(false); // guoss

                setEditingObject(beanData);

                haveInitFlag = true;

                i++;

              } else if (valId.equals("3")) { // 采购组织形式和申请采购方式的联动

                haveInitFlag = false;

                // 临时取消选择分散采购时的控件内容及可用联动   Update By FengYan 2011-06-14

                //          beanData.setZcPitemOpiway("6");

                //              beanData.setZcPifuCgfs("6");

                // 判断是采购组织形式选项是否有变化,有变化则清空委托机构名称

                if (!valId.equals(valSetId) && i > 0) {

                  if (!fukuanValId.equals(valId) && beanData.getZcMakeStatus().equals("0")) {

                    beanData.setAgencyName("");

                    beanData.setAgency("");
                  }

                  valSetId = "3";

                  fukuanValId = "3";
                }

                // 临时取消选择分散采购时的控件内容及可用联动   Update By FengYan 2011-06-14

                // zcPifuCgfs.setEnabled(false);

                // zcPitemOpiway.setEnabled(false);

                valSetId = "3";

                fukuanValId = "3";

                zcAgeyCode.setEnabled(true);

                zcAgeyCode.setEditable(false); // guoss

                setEditingObject(beanData);

                haveInitFlag = true;

                i++;
              }

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

                zcImpFile.setEnabled(false);
              }
            }
          }
        };
    zcMakeSequence
        .getField()
        .addItemListener(
            new ItemListener() {

              public void itemStateChanged(ItemEvent event) {

                if (event.getStateChange() == ItemEvent.SELECTED && haveInitFlag) {

                  haveInitFlag = false;

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

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

                  data.setZcMakeSequence(valId);

                  data.setZcMakePfSequence(valId);

                  zcMakePfSequence.setEnabled(false);

                  haveInitFlag = true;

                  setEditingObject(data);
                }
              }
            });

    TextFieldEditor zcAgeyName =
        new TextFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_TRUST_AGEY_NAME), "agencyName");

    zcAgeyName.setVisible(false);

    zcAgeyName.setEnabled(false);

    //    AsValFieldEditor zcIsBudget = new AsValFieldEditor("是否公开预算", "zcIsBudget", "VS_Y/N");
    //
    //    zcIsBudget.setVisible(false); // wangkewei 编辑页面隐藏【是否公开预算】按钮
    //
    //    editorList.add(zcIsBudget);

    // 拟定采购方式  (1公开招标,2邀请招标,3竞争性谈判,4单一来源采购,5询价,6其他)

    zcPitemOpiway =
        new AsValFieldEditor(
            LangTransMeta.translate(FIELD_TRANS_ZC_PITEM_OPIWAY),
            "zcPitemOpiway",
            "ZC_VS_PITEM_OPIWAY");

    zcPitemOpiway
        .getField()
        .addItemListener(
            new ItemListener() {

              public void itemStateChanged(ItemEvent event) {

                if (event.getStateChange() == ItemEvent.SELECTED && haveInitFlag) {

                  /* 拟定采购方式和批复采购方式联动 */

                  haveInitFlag = false;

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

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

                  data.setZcPitemOpiway(valId);

                  data.setZcPifuCgfs(valId);

                  data.setZcAttr3("");

                  zcPifuCgfs.setEnabled(false);

                  haveInitFlag = true;
                  //
                  //          if ("7".equals(valId)) { //如果是协议供货二次竞价,竞价品牌可编辑
                  //
                  //            data.setZcAttr3("");
                  //
                  //            zcAttr3.setEnabled(true);
                  //
                  //          } else {
                  //
                  //            zcAttr3.setEnabled(false);
                  //
                  //          }

                  setEditingObject(data);
                }
              }
            });

    // 批复采购方式 ( 1公开招标,2邀请招标,3竞争性谈判,4单一来源采购,5询价,6其他)

    zcPifuCgfs =
        new AsValFieldEditor(
            LangTransMeta.translate(FIELD_TRANS_ZC_PIFU_CGFS), "zcPifuCgfs", "ZC_VS_PITEM_OPIWAY") {

          private static final long serialVersionUID = 546680855108337426L;

          protected void afterChange(AsValComboBox field) {
            changeWay(field);
          }
        };

    zcIsImp =
        new AsValFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_IS_IMP), "zcIsImp", "VS_Y/N");

    // add by wangkw   start

    zcIsImp
        .getField()
        .addItemListener(
            new ItemListener() {

              public void itemStateChanged(ItemEvent event) {

                if (event.getStateChange() == ItemEvent.SELECTED) {

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

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

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

                    if (data.getZcImpFileBlobid() != null) {

                      baseDataServiceDelegate.deleteFile(data.getZcImpFileBlobid(), requestMeta);
                    }

                    data.setZcImpFile(null);

                    data.setZcImpFileBlobid(null);

                    zcImpFile.setEnabled(false);

                  } else {

                    zcImpFile.setEnabled(true);
                  }
                }
              }
            });

    // end
    DateFieldEditor zcInputDate =
        new DateFieldEditor(
            LangTransMeta.translate(ZcPProBalConstants.FIELD_TRANS_ZC_INPUT_DATE), "zcInputDate");
    zcInputDate.setEnabled(false);
    zcImpFile =
        new FileFieldEditor(
            LangTransMeta.translate(FIELD_TRANS_ZC_IMP_FILE), "zcImpFile", "zcImpFileBlobid");

    TextFieldEditor zcIsRemark =
        new TextFieldEditor(LangTransMeta.translate(FIELD_TRANS_ZC_IS_REMARK), "zcIsRemark");

    ZcPProHandler zcPProHandler = new ZcPProHandler(self, this.listCursor);

    ElementConditionDto proDto = new ElementConditionDto();

    proDto.setZcText0(requestMeta.getEmpCode());

    ForeignEntityFieldEditor proName =
        new ForeignEntityFieldEditor(
            "ZC_P_PRO.getZcPPro",
            proDto,
            20,
            zcPProHandler,
            zcPProHandler.getColumNames(),
            "预算项目",
            "proName");
    zcMakeStatus.setEnabled(false);

    zcMakePfSequence =
        new AsValFieldEditor("批复采购组织形式", "zcMakeSequence", "VS_ZC_ORGTYPE") {

          private static final long serialVersionUID = 454290003043403563L;

          int i = 0; // add by wangkewei,用于判断是不是第一次调用afterChange

          protected void afterChange(AsValComboBox field) { // hjh inserted 2011-5-5 17:53
            if (field.getSelectedAsVal() == null) {
              return;
            }

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

            if (beanData.getProcessInstId() != null
                && beanData.getProcessInstId() > 0
                && !beanData.getZcMakeStatus().equals("0")
                && saveButton.isVisible()) {

              String valId = field.getSelectedAsVal().getValId();

              // 采购组织形式和采购方式的联动

              if (valId.equals("1")) { // 采购组织形式和委托机构名称联动 :政府集中采购必须为采购中心,不可修改,不可改变

                haveInitFlag = false;

                beanData.setAgencyName(AsOptionMeta.getOptVal("OPT_ZC_CGZX_NAME"));

                beanData.setAgency(AsOptionMeta.getOptVal("OPT_ZC_CGZX_CODE"));

                zcAgeyCode.setEnabled(false); // wangkewei

                setEditingObject(beanData);

                haveInitFlag = true;

                valSetId = "1";

                fukuanValId = "1";

                i++;

              } else if (valId.equals("2")) {

                haveInitFlag = false;

                // 判断是采购组织形式选项是否有变化,有变化则清空委托机构名称

                if (!valId.equals(valSetId) && i > 0) { // 如果不是第一次调用,将委托机构名称设置为空,如果是第一次调用,界面上显示数据库的值

                  if (!fukuanValId.equals(valId)
                      && !beanData.getZcMakeStatus().equals("0")
                      && saveButton.isVisible()) {

                    beanData.setAgencyName("");

                    beanData.setAgency("");
                  }
                }

                valSetId = "2";

                fukuanValId = "2";

                zcAgeyCode.setEnabled(true);

                zcAgeyCode.setEditable(false);

                setEditingObject(beanData);

                haveInitFlag = true;

                i++;

              } else if (valId.equals("3")) { // 采购组织形式和申请采购方式的联动

                haveInitFlag = false;

                if (!valId.equals(valSetId) && i > 0) {

                  if (!fukuanValId.equals(valId)
                      && !beanData.getZcMakeStatus().equals("0")
                      && saveButton.isVisible()) {

                    beanData.setAgencyName("");

                    beanData.setAgency("");
                  }

                  valSetId = "3";

                  fukuanValId = "3";
                }

                valSetId = "3";

                fukuanValId = "3";

                zcAgeyCode.setEnabled(true);

                zcAgeyCode.setEditable(false); // guoss

                setEditingObject(beanData);

                haveInitFlag = true;

                i++;
              }

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

                zcImpFile.setEnabled(false);
              }
            }
          }
        };

    isDesSup = new AsValFieldEditor("是否指定供应商", "isDesSup", "ZC_VS_YN");

    isPub = new AsValFieldEditor("是否公示", "isPub", "ZC_VS_YN");

    isCar =
        new AsValFieldEditor(
            LangTransMeta.translate(ZcElementConstants.FIELD_TRANS_ZC_P_PROMAKE_IS_CAR),
            "isCar",
            "ZC_VS_YN");

    // ---

    editorList.add(zcMakeName);
    editorList.add(zcMoneyBiSum);
    editorList.add(zcMakeStatus);

    editorList.add(zcCoCode);
    editorList.add(zcMakeCode);
    editorList.add(zcZgCsCode);

    editorList.add(isCar);
    editorList.add(zcIsImp);
    editorList.add(zcImpFile);

    editorList.add(zcMakeLinkman);
    editorList.add(zcAttr2);
    editorList.add(zcMakeTel);

    editorList.add(zcPifuCgfs);
    editorList.add(zcInputDate);
    editorList.add(zcIsRemark);

    return editorList;
  }
Exemplo n.º 2
0
package com.ufgov.zc.client.component.zc.fieldeditor.zcbagency;