NC6 供应商基本信息变更申请卡片界面 表头和表体颜色处理类

360 篇文章 104 订阅

表头颜色处理类

package nc.ui.srmsm.supplierbaschgpf.maintain.util;

import nc.ui.bill.tools.ColorConstants;
import nc.ui.pub.bill.BillCardPanel;
import nc.ui.pub.bill.BillItem;
import nc.ui.srmpub.util.HeadUIPanelUtil;
import nc.vo.bd.supplier.SupplierVO;
import nc.vo.bd.supplierext.entity.SupplierExtHVO;
import nc.vo.bd.supplierext.entity.SupplierExtVO;
import nc.vo.srmsm.supplierbaschgpf.entity.SupplierBasChgPFConst;
import nc.vo.srmsm.supplierbaschgpf.entity.SupplierBasChgPFVO;

/**
 * 供应商基本信息变更申请卡片界面 表头颜色处理类<br>
 * <b>使用场景:</b>
 * <ol>
 * <li>单据"新增"操作</li>
 * <li>单据"修改"操作</li>
 * <li>鼠标双击列表卡片切换</li>
 * <li>翻页</li>
 * </ol>
 * 
 * @since 6.31
 * @version 2013-10-24 14:32:15
 * @author miaoff
 */
public class HeadColorUtil {

  /** 修改字段标识颜色 */
  private final static int COLOR_UPDATEITEM = ColorConstants.COLOR_RED;

  /**
   * "供应商基本信息"页签与"供应商扩展信息"页签中修改的字段用红色标识
   * 
   * @param panel
   *          卡片面板
   * @param pk_supplier
   *          UAP供应商档案主键
   * @param supvo
   *          供应商基本信息实体
   * @param extvo
   *          供应商扩展信息实体
   */
  public void colorAction(BillCardPanel panel, String pk_supplier,
      SupplierVO supvo, SupplierExtVO extvo) {
    this.paintSupplierBasInfo(pk_supplier, supvo, panel);
    this.paintSupplierExtInfo(pk_supplier, extvo, panel);
  }

  /**
   * "供应商基本信息"页签中修改的字段用红色标识
   * 
   * @param panel
   *          卡片面板
   * @param pk_supplier
   *          UAP供应商档案主键
   * @param supvo
   *          供应商基本信息实体
   */
  public void paintSupplierBasInfo(String pk_supplier, SupplierVO supvo,
      BillCardPanel panel) {
    // "供应商基本信息"页签中修改的字段用红色标识
    if (null != supvo) {
      HeadUIPanelUtil.resetColorHeadItems(panel, supvo,
          HeadColorUtil.COLOR_UPDATEITEM, SupplierBasChgPFConst.BASETABLECODE);
    }
    else {
      SupplierVO[] suppliervos =
          CommonHelper.querySupplierByPkSupplier(pk_supplier);
      if (null == suppliervos) {
        return;
      }
      SupplierBasChgPFVO[] basChgVos =
          VOTransfer.chgSupplierVOToSupplierBasChgPFVO(suppliervos);
      HeadUIPanelUtil.resetColorHeadItems(panel, basChgVos[0],
          HeadColorUtil.COLOR_UPDATEITEM, SupplierBasChgPFConst.BASETABLECODE);
    }
    BillItem supplierItem = panel.getHeadItem(SupplierBasChgPFVO.PK_SUPPLIER);
    supplierItem.setForeground(ColorConstants.COLOR_DEFAULT);
  }

  /**
   * "供应商扩展信息"页签中修改的字段用红色标识
   * 
   * @param panel
   *          卡片面板
   * @param pk_supplier
   *          UAP供应商档案主键
   * @param extvo
   *          供应商扩展信息实体
   */
  public void paintSupplierExtInfo(String pk_supplier, SupplierExtVO extvo,
      BillCardPanel panel) {
    // 先清空供应商扩展信息页签字段标识颜色,再标识修改的字段
    this.resetColorSupplierExt(panel);
    SupplierExtHVO exthvo = null;
    if (null != extvo) {
      exthvo = extvo.getParentVO();
    }
    else {
      SupplierExtVO queryvo =
          CommonHelper.querySupplierExtByByPkSupplier(pk_supplier, null, null);
      exthvo = queryvo == null ? null : queryvo.getParentVO();
    }

    if (null == exthvo) {
      exthvo = new SupplierExtHVO();
    }
    // "供应商扩展信息"页签中修改的字段用红色标识
    HeadUIPanelUtil.resetColorHeadItems(panel, exthvo,
        HeadColorUtil.COLOR_UPDATEITEM, SupplierBasChgPFConst.EXTTABLECODE);
  }

  /**
   * 将卡片面板标识为修改色的字段还原为默认颜色
   * 
   * @param panel
   *          卡片面板
   */
  public void resetColorAction(BillCardPanel panel) {
    HeadUIPanelUtil.resetColorHeadItems(panel, ColorConstants.COLOR_DEFAULT);
  }

  private void resetColorSupplierExt(BillCardPanel panel) {
    String[] extableCodes =
        new String[] {
          "supplierext", "supplierorder", "supplierdescribe", "suppliersale",
          "supplierbas", "supplierservice"
        };
    this.resetColorSupplierExt(panel, extableCodes);
  }

  private void resetColorSupplierExt(BillCardPanel panel, String[] tableCodes) {
    for (String tablecode : tableCodes) {
      BillItem[] items = panel.getHeadShowItems(tablecode);
      if (items != null) {
        for (BillItem item : items) {
          item.setForeground(ColorConstants.COLOR_DEFAULT);
        }
      }
    }
  }

}

表体颜色处理类

package nc.ui.srmsm.supplierbaschgpf.maintain.util;

import java.awt.Color;

import nc.ui.pub.bill.BillCardPanel;
import nc.ui.pub.bill.BillItem;
import nc.ui.pub.bill.BillScrollPane;
import nc.ui.srmpub.util.BodyUIPanelUtil;
import nc.vo.bd.bankaccount.BankAccbasVO;
import nc.vo.bd.supplierext.entity.SupplierExtAVO;
import nc.vo.bd.supplierext.entity.SupplierExtIVO;
import nc.vo.bd.supplierext.entity.SupplierExtPVO;
import nc.vo.bd.supplierext.entity.SupplierExtQVO;
import nc.vo.bd.supplierext.entity.SupplierExtVO;
import nc.vo.srmpub.util.SRMBaseUtil;
import nc.vo.srmsm.supplierbaschgpf.entity.AggSupplierBasChgPFVO;
import nc.vo.srmsm.supplierbaschgpf.entity.SupplierBasChgPFAVO;
import nc.vo.srmsm.supplierbaschgpf.entity.SupplierBasChgPFBVO;
import nc.vo.srmsm.supplierbaschgpf.entity.SupplierBasChgPFIVO;
import nc.vo.srmsm.supplierbaschgpf.entity.SupplierBasChgPFPVO;
import nc.vo.srmsm.supplierbaschgpf.entity.SupplierBasChgPFQVO;

/**
 * 供应商基本信息变更申请卡片界面 表体面板工具类 <br>
 * <b>使用场景:</b>
 * <ol>
 * <li>单据"新增"操作</li>
 * <li>单据"修改"操作</li>
 * <li>鼠标双击列表卡片切换</li>
 * <li>翻页</li>
 * </ol>
 * </ol>
 * 
 * @since 6.31
 * @version 2013-10-23 14:50:15
 * @author miaoff
 */
public class BodyColorUtil {

  /** 默认 行字段 标识颜色 */
  private final static Color COLOR_DEFAULT = Color.BLACK;

  /** 插入 行字段 标识颜色 */
  private final static Color COLOR_INSERT = Color.ORANGE; // Color.ORANGE

  /** 修改 行字段 标识颜色 */
  private final static Color COLOR_UPDATE = Color.RED;

  /**
   * 清空表体卡片面板
   * 
   * @param panel
   *          卡片面板
   */
  public void clearBodyUIPanel(BillCardPanel panel) {
    BodyUIPanelUtil.clearBodyUIPanel(panel,
        SupplierBasChgPFPVO.PK_SUPPLIERBASCHGPF_P);
    BodyUIPanelUtil.clearBodyUIPanel(panel,
        SupplierBasChgPFQVO.PK_SUPPLIERBASCHGPF_Q);
    BodyUIPanelUtil.clearBodyUIPanel(panel,
        SupplierBasChgPFIVO.PK_SUPPLIERBASCHGPF_I);
    BodyUIPanelUtil.clearBodyUIPanel(panel,
        SupplierBasChgPFBVO.PK_SUPPLIERBASCHGPF_B);
    BodyUIPanelUtil.clearBodyUIPanel(panel,
        SupplierBasChgPFAVO.PK_SUPPLIERBASCHGPF_A);
  }

  /**
   * 单据颜色处理.使用于列表卡片切换、翻页场景、"修改"操作.
   * 
   * @param panel
   *          卡片面板
   * @param aggvo
   *          供应商基本信息变更申请实体
   */
  public void colorAction(BillCardPanel panel, AggSupplierBasChgPFVO aggvo) {
    String pk_supplier = aggvo.getParentVO().getPk_supplier();

    // 对"供应商基本信息"表体新增行用橙色标识,修改列用红色标识
    BankAccbasVO[] bankvos =
        CommonHelper.queryBankAccbasVOByPkSupplier(pk_supplier);
    if (SRMBaseUtil.isArrayElementsNull(bankvos)) {
      SupplierBasChgPFBVO[] basChgBvos = aggvo.getSupplierBasChgPFBVO();
      this.changeToSupplierBasB(panel, basChgBvos);
    }
    else {
      SupplierBasChgPFBVO[] basChgBvos =
          VOTransfer.chgBankAccbacVOToSupplierBasChgPFBVO(bankvos);
      this.changeToSupplierBasB(panel, basChgBvos);
    }

    // 对"供应商扩展信息"表体新增行用橙色标识,修改列用红色标识
    SupplierExtVO extVO =
        CommonHelper.querySupplierExtByByPkSupplier(pk_supplier, null, null);
    if (SRMBaseUtil.isObjectNullValue(extVO)) {
      this.changeToSupplierExtP(panel, null);
      this.changeToSupplierExtQ(panel, null);
      this.changeToSupplierExtI(panel, null);
      this.changeToSupplierExtA(panel, null);
      return;
    }

    SupplierExtPVO[] extPVOs = extVO.getSupplierExtPVO();
    SupplierBasChgPFPVO[] oldBasChgPvos =
        VOTransfer.chgSupplierExtPVOToSupplierBasChgPFPVO(extPVOs);
    this.changeToSupplierExtP(panel, oldBasChgPvos);

    SupplierExtQVO[] extQVOs = extVO.getSupplierExtQVO();
    SupplierBasChgPFQVO[] oldBasChgQvos =
        VOTransfer.chgSupplierExtQVOToSupplierBasChgPFQVO(extQVOs);
    this.changeToSupplierExtQ(panel, oldBasChgQvos);

    SupplierExtIVO[] extIVOs = extVO.getSupplierExtIVO();
    SupplierBasChgPFIVO[] oldBasChgIvos =
        VOTransfer.chgSupplierExtIVOToSupplierBasChgPFIVO(extIVOs);
    this.changeToSupplierExtI(panel, oldBasChgIvos);

    SupplierExtAVO[] extAVOs = extVO.getSupplierExtAVO();
    SupplierBasChgPFAVO[] oldBasChgAvos =
        VOTransfer.chgSupplierExtAVOToSupplierBasChgPFAVO(extAVOs);
    this.changeToSupplierExtA(panel, oldBasChgAvos);

  }

  /**
   * 单据颜色处理.使用于单据"新增"操作、"修改"操作.
   * 
   * @param panel
   *          卡片面板
   * @param bankvos
   *          银行账号实体
   * @param extVO
   *          供应商扩展信息实体
   */
  public void colorAction(BillCardPanel panel, BankAccbasVO[] bankvos,
      SupplierExtVO extVO) {

    SupplierBasChgPFBVO[] basChgBvos =
        VOTransfer.chgBankAccbacVOToSupplierBasChgPFBVO(bankvos);
    // 对"供应商基本信息"表体新增行用橙色标识,修改列用红色标识
    this.changeToSupplierBasB(panel, basChgBvos);

    // 对"供应商扩展信息"表体新增行用橙色标识,修改列用红色标识
    SupplierExtPVO[] extPVOs = extVO.getSupplierExtPVO();
    SupplierBasChgPFPVO[] basChgPvos =
        VOTransfer.chgSupplierExtPVOToSupplierBasChgPFPVO(extPVOs);
    this.changeToSupplierExtP(panel, basChgPvos);

    SupplierExtQVO[] extQVOs = extVO.getSupplierExtQVO();
    SupplierBasChgPFQVO[] basChgQvos =
        VOTransfer.chgSupplierExtQVOToSupplierBasChgPFQVO(extQVOs);
    this.changeToSupplierExtQ(panel, basChgQvos);

    SupplierExtIVO[] extIVOs = extVO.getSupplierExtIVO();
    SupplierBasChgPFIVO[] basChgIvos =
        VOTransfer.chgSupplierExtIVOToSupplierBasChgPFIVO(extIVOs);
    this.changeToSupplierExtI(panel, basChgIvos);

    SupplierExtAVO[] extAVOs = extVO.getSupplierExtAVO();
    SupplierBasChgPFAVO[] basChgAvos =
        VOTransfer.chgSupplierExtAVOToSupplierBasChgPFAVO(extAVOs);
    this.changeToSupplierExtA(panel, basChgAvos);
  }

  /**
   * 还原表体卡片字段颜色为默认
   * 
   * @param panel
   *          卡片面板
   */
  public void resetColorAction(BillCardPanel panel) {
    BodyUIPanelUtil.resetColorAction(panel,
        SupplierBasChgPFPVO.PK_SUPPLIERBASCHGPF_P, BodyColorUtil.COLOR_DEFAULT);
    BodyUIPanelUtil.resetColorAction(panel,
        SupplierBasChgPFQVO.PK_SUPPLIERBASCHGPF_Q, BodyColorUtil.COLOR_DEFAULT);
    BodyUIPanelUtil.resetColorAction(panel,
        SupplierBasChgPFIVO.PK_SUPPLIERBASCHGPF_I, BodyColorUtil.COLOR_DEFAULT);
    BodyUIPanelUtil.resetColorAction(panel,
        SupplierBasChgPFBVO.PK_SUPPLIERBASCHGPF_B, BodyColorUtil.COLOR_DEFAULT);
    BodyUIPanelUtil.resetColorAction(panel,
        SupplierBasChgPFAVO.PK_SUPPLIERBASCHGPF_A, BodyColorUtil.COLOR_DEFAULT);
  }

  /**
   * "银行账号"表体修改列用红色标识,新增行用橙色标识
   */
  private void changeToSupplierBasB(BillCardPanel panel,
      SupplierBasChgPFBVO[] basChgBvos) {
    BillScrollPane pane =
        panel.getBodyPanel(SupplierBasChgPFBVO.PK_SUPPLIERBASCHGPF_B);
    BillItem[] showItems =
        panel.getBillData().getBodyShowItems(
            SupplierBasChgPFBVO.PK_SUPPLIERBASCHGPF_B);
    int rowcount = pane.getTable().getRowCount();

    if (SRMBaseUtil.isArrayElementsNull(basChgBvos)) {
      for (int i = 0; i < rowcount; i++) {
        for (BillItem item : showItems) {
          pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
        }
      }
      return;
    }

    for (int i = 0; i < rowcount; i++) {
      Object pk_supplierbankacc =
          pane.getTableModel().getValueAt(i,
              SupplierBasChgPFBVO.PK_SUPPLIERBANKACC);
      // 新增行
      if (null == pk_supplierbankacc) {
        for (BillItem item : showItems) {
          pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
        }
      }
      // 修改行
      else {
        for (SupplierBasChgPFBVO bvo : basChgBvos) {
          if (bvo.getPk_supplierbankacc().equals(pk_supplierbankacc)) {
            BodyUIPanelUtil.resetColorBodyItemsByShangjd(panel, i,
                SupplierBasChgPFBVO.PK_SUPPLIERBASCHGPF_B, bvo,
                BodyColorUtil.COLOR_UPDATE);
            break;
          }
        }
      }
    }
  }

  /**
   * "供应商供货能力分类"表体修改列用红色标识,新增行用橙色标识
   */
  private void changeToSupplierExtA(BillCardPanel panel,
      SupplierBasChgPFAVO[] basChgAvos) {
    BillScrollPane pane =
        panel.getBodyPanel(SupplierBasChgPFAVO.PK_SUPPLIERBASCHGPF_A);
    BillItem[] showItems =
        panel.getBillData().getBodyShowItems(
            SupplierBasChgPFAVO.PK_SUPPLIERBASCHGPF_A);
    int rowcount = pane.getTable().getRowCount();

    if (SRMBaseUtil.isArrayElementsNull(basChgAvos)) {
      for (int i = 0; i < rowcount; i++) {
        for (BillItem item : showItems) {
          pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
        }
      }
      return;
    }

    for (int i = 0; i < rowcount; i++) {
      // 供应商扩展信息暂无供货能力分类信息这里不做判断
      Object pk_supplierext_a =
          pane.getTableModel().getValueAt(i,
              SupplierBasChgPFAVO.PK_SUPPLIEREXT_A);
      // 新增行
      if (null == pk_supplierext_a) {
        for (BillItem item : showItems) {
          pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
        }
      }
      // 修改行
      else {
        /*
         * BodyUIPanelUtil.resetColorBodyItems(panel, basChgAvos,
         * BodyColorUtil.COLOR_UPDATE);
         */
        for (SupplierBasChgPFAVO avo : basChgAvos) {
          if (avo.getPk_supplierext_a().equals(pk_supplierext_a)) {
            BodyUIPanelUtil.resetColorBodyItemsByShangjd(panel, i,
                SupplierBasChgPFAVO.PK_SUPPLIERBASCHGPF_A, avo,
                BodyColorUtil.COLOR_UPDATE);
            break;
          }
        }
      }
    }
  }

  /**
   * "供应商资料"表体修改列用红色标识,新增行用橙色标识
   */
  private void changeToSupplierExtI(BillCardPanel panel,
      SupplierBasChgPFIVO[] basChgIvos) {
    BillScrollPane pane =
        panel.getBodyPanel(SupplierBasChgPFIVO.PK_SUPPLIERBASCHGPF_I);
    BillItem[] showItems =
        panel.getBillData().getBodyShowItems(
            SupplierBasChgPFIVO.PK_SUPPLIERBASCHGPF_I);
    int rowcount = pane.getTable().getRowCount();

    if (SRMBaseUtil.isArrayElementsNull(basChgIvos)) {
      for (int i = 0; i < rowcount; i++) {
        for (BillItem item : showItems) {
          pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
        }
      }
      return;
    }

    for (int i = 0; i < rowcount; i++) {
      Object pk_supplierext_i =
          pane.getTableModel().getValueAt(i,
              SupplierBasChgPFIVO.PK_SUPPLIEREXT_I);
      // 新增行
      if (null == pk_supplierext_i) {
        for (BillItem item : showItems) {
          pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
        }
      }
      // 修改行
      else {
        // BodyUIPanelUtil.resetColorBodyItems(panel, basChgIvos,
        // BodyColorUtil.COLOR_UPDATE);
        //
        for (SupplierBasChgPFIVO ivo : basChgIvos) {
          if (ivo.getPk_supplierext_i().equals(pk_supplierext_i)) {
            BodyUIPanelUtil.resetColorBodyItemsByShangjd(panel, i,
                SupplierBasChgPFIVO.PK_SUPPLIERBASCHGPF_I, ivo,
                BodyColorUtil.COLOR_UPDATE);
            break;
          }
        }
      }
    }
  }

  /**
   * "可供货产品"表体修改列用红色标识,新增行用橙色标识
   */
  private void changeToSupplierExtP(BillCardPanel panel,
      SupplierBasChgPFPVO[] basChgPvos) {
    BillScrollPane pane =
        panel.getBodyPanel(SupplierBasChgPFPVO.PK_SUPPLIERBASCHGPF_P);
    BillItem[] showItems =
        panel.getBillData().getBodyShowItems(
            SupplierBasChgPFPVO.PK_SUPPLIERBASCHGPF_P);
    int rowcount = pane.getTable().getRowCount();

    if (SRMBaseUtil.isArrayElementsNull(basChgPvos)) {
      for (int i = 0; i < rowcount; i++) {
        for (BillItem item : showItems) {
          pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
        }
      }
      return;
    }

    for (int i = 0; i < rowcount; i++) {
      Object pk_supplierext_p =
          pane.getTableModel().getValueAt(i,
              SupplierBasChgPFPVO.PK_SUPPLIEREXT_P);
      // 新增行
      if (null == pk_supplierext_p) {
        for (BillItem item : showItems) {
          pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
        }
      }
      // 修改行
      else {
        // BodyUIPanelUtil.resetColorBodyItems(panel, basChgPvos,
        // BodyColorUtil.COLOR_UPDATE);

        for (SupplierBasChgPFPVO pvo : basChgPvos) {
          if (pvo.getPk_supplierext_p().equals(pk_supplierext_p)) {
            BodyUIPanelUtil.resetColorBodyItemsByShangjd(panel, i,
                SupplierBasChgPFPVO.PK_SUPPLIERBASCHGPF_P, pvo,
                BodyColorUtil.COLOR_UPDATE);
            break;
          }
        }
      }
    }
  }

  /**
   * "供应商资质"表体修改列用红色标识,新增行用橙色标识
   */
  private void changeToSupplierExtQ(BillCardPanel panel,
      SupplierBasChgPFQVO[] basChgQvos) {
    BillScrollPane pane =
        panel.getBodyPanel(SupplierBasChgPFQVO.PK_SUPPLIERBASCHGPF_Q);
    BillItem[] showItems =
        panel.getBillData().getBodyShowItems(
            SupplierBasChgPFQVO.PK_SUPPLIERBASCHGPF_Q);
    int rowcount = pane.getTable().getRowCount();

    if (SRMBaseUtil.isArrayElementsNull(basChgQvos)) {
      for (int i = 0; i < rowcount; i++) {
        for (BillItem item : showItems) {
          pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
        }
      }
      return;
    }

    for (int i = 0; i < rowcount; i++) {
      Object pk_supplierext_q =
          pane.getTableModel().getValueAt(i,
              SupplierBasChgPFQVO.PK_SUPPLIEREXT_Q);
      // 新增行
      if (null == pk_supplierext_q) {
        for (BillItem item : showItems) {
          pane.setCellForeGround(i, item.getKey(), BodyColorUtil.COLOR_INSERT);
        }
      }
      // 修改行
      else {
        // BodyUIPanelUtil.resetColorBodyItems(panel, basChgQvos,
        // BodyColorUtil.COLOR_UPDATE);

        for (SupplierBasChgPFQVO qvo : basChgQvos) {
          if (qvo.getPk_supplierext_q().equals(pk_supplierext_q)) {
            BodyUIPanelUtil.resetColorBodyItemsByShangjd(panel, i,
                SupplierBasChgPFQVO.PK_SUPPLIERBASCHGPF_Q, qvo,
                BodyColorUtil.COLOR_UPDATE);
            break;
          }
        }
      }
    }
  }

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值