package com.gx.obe.management.composite;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.eclipse.core.runtime.Platform;
import org.eclipse.swt.SWT;
import org.eclipse.swt.core.CallBack;
import org.eclipse.swt.core.ImageResolver;
import org.eclipse.swt.core.MessageDialog;
import org.eclipse.swt.core.utils.FileDialogUtils;
import org.eclipse.swt.core.utils.WidgetUtils;
import org.eclipse.swt.core.widgets.ELink;
import org.eclipse.swt.core.widgets.EOp;
import org.eclipse.swt.core.widgets.ImageButton;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowData;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;

import com.gx.obe.ColorConstants;
import com.gx.obe.action.bean.Action;
import com.gx.obe.action.listener.ActionListener;
import com.gx.obe.action.utils.ActionUtil;
import com.gx.obe.business.enumeration.MenuEnum;
import com.gx.obe.common.file.enumeration.FileConstants;
import com.gx.obe.common.icons.IconsActivator;
import com.gx.obe.common.widget.button.StepButton;
import com.gx.obe.common.widget.composite.TipsComposite;
import com.gx.obe.common.widget.thread.SyncThread;
import com.gx.obe.common.widget.utils.MenuFunctionUtils;
import com.gx.obe.components.core.I18NEnum;
import com.gx.obe.components.core.enumeration.CommonEnum;
import com.gx.obe.components.core.enumeration.EvaluationFactorEnum;
import com.gx.obe.components.core.enumeration.EvaluationStepEnum;
import com.gx.obe.components.core.enumeration.TenderProjectEnum;
import com.gx.obe.config.ConfigConstants;
import com.gx.obe.config.utils.PropertiesUtils;
import com.gx.obe.evaluation.step.form.AddExpertSignDialog;
import com.gx.obe.evaluation.step.form.BillEvaluationStepDialog;
import com.gx.obe.evaluation.step.form.BusinessEvaluationStepDialog;
import com.gx.obe.evaluation.step.form.BusinessVetoEvaluationStepDialog;
import com.gx.obe.evaluation.step.form.CleanTenderEvaluationStepDialog;
import com.gx.obe.evaluation.step.form.ComplianceEvaluationStepDialog;
import com.gx.obe.evaluation.step.form.CreditEvaluationStepDialog;
import com.gx.obe.evaluation.step.form.EditPriceStepDialog;
import com.gx.obe.evaluation.step.form.EngineeringStepDialog;
import com.gx.obe.evaluation.step.form.FeatureEvaluationStepDialog;
import com.gx.obe.evaluation.step.form.LimitPriceEvaluationStepDialog;
import com.gx.obe.evaluation.step.form.MultiRoundsPriceEvaluationStepDialog;
import com.gx.obe.evaluation.step.form.PreEvaluationStepDialog;
import com.gx.obe.evaluation.step.form.PriceScoreEvaluationStepDialog;
import com.gx.obe.evaluation.step.form.RecommendRankEvaluationStepDialog;
import com.gx.obe.evaluation.step.form.RecommonedEvaluationStepDialog;
import com.gx.obe.evaluation.step.form.ScoreEvaluationStepDialog;
import com.gx.obe.evaluation.step.form.TianYanEvaluationStepDialog;
import com.gx.obe.evaluation.step.form.TotalPriceEvaluationStepDialog;
import com.gx.obe.evaluation.step.form.VetoBidEvaluationStepDialog;
import com.gx.obe.evaluation.step.form.WasteBidStepDialog;
import com.gx.obe.evaluation.step.resutl.action.ComplianceEvaluationResultAction;
import com.gx.obe.evaluation.step.resutl.action.CreditEvaluationResultAction;
import com.gx.obe.evaluation.step.resutl.action.EditPriceResultAction;
import com.gx.obe.evaluation.step.resutl.action.ExpertSignResutlAction;
import com.gx.obe.evaluation.step.resutl.action.FeatureCodeCheckResultAction;
import com.gx.obe.evaluation.step.resutl.action.LimitPriceEvaluationResultAction;
import com.gx.obe.evaluation.step.resutl.action.MultiWheelPriceEvaluationResultAction;
import com.gx.obe.evaluation.step.resutl.action.PreEvaluationResultAction;
import com.gx.obe.evaluation.step.resutl.action.PriceEvaluationResultAction;
import com.gx.obe.evaluation.step.resutl.action.RecommendRankEvaluationResultAction;
import com.gx.obe.evaluation.step.resutl.action.RecommonedEvaluationResultAction;
import com.gx.obe.evaluation.step.resutl.action.ScoreEvaluationResultAction;
import com.gx.obe.evaluation.step.resutl.action.TotalPriceEvaluationResultAction;
import com.gx.obe.evaluation.step.resutl.action.VetoBidEvaluationResultAction;
import com.gx.obe.evaluation.step.review.action.AbandonEvalutionAction;
import com.gx.obe.evaluation.step.review.action.TianYanCheckResultAction;
import com.gx.obe.management.dialog.ApplyToOtherTenderPackDialog;
import com.gx.obe.management.dialog.CreateDefaultEvauationStepDialog;
import com.gx.obe.management.shell.EvaluationStepOperatorShell;
import com.gx.obe.management.shell.EvaluationStepOperatorShell.EvaluationStepListener;
import com.gx.obe.message.Messages;
import com.gx.obe.thread.CreateEvaluationStepThread;
import com.gx.obe.util.utils.LogUtils;
import com.gx.obe.util.utils.ObjectUtils;
import com.gx.obe.util.utils.StringUtils;
import com.gx.obe.util.utils.XmlUtils;
import com.gx.obe.web.entity.auth.Menu;
import com.gx.obe.web.entity.evaluation.EvaluationFactor;
import com.gx.obe.web.entity.evaluation.EvaluationStep;
import com.gx.obe.web.entity.tender.TenderProjectEntity;
import com.gx.obe.web.entity.tender.TenderProjectRuleEntity;
import com.gx.obe.web.service.BidPriceHisResultService;
import com.gx.obe.web.service.MenuService;
import com.gx.obe.web.service.TenderProjectService;
import com.gx.obe.web.service.evaluation.EvaluationFactorService;
import com.gx.obe.web.service.evaluation.EvaluationGroupService;
import com.gx.obe.web.service.evaluation.EvaluationStepService;
import com.gx.utils.XmlBeanUtils;
import com.swtdesigner.ResourceManager;
import com.swtdesigner.SWTResourceManager;

/**
 * @Description: 评标步骤管理
 * @author guoyr
 */
public class EvaluationStepManagerComposite extends Composite implements ActionListener {

	private ImageResolver imageResolver = new ImageResolver();
	private SashForm sashForm;
	private Composite evaluationStepComposite;
	private ELink signEvalStep;
	private ELink featureCheckStep;
	private ELink tianYanCheckStep;
	private ELink limitPriceStep;
	private ELink cleanTenderStep;
	private ELink complianceEvalStep;
	private ELink detailEvalStep;
	private ELink multiWheelPriceEvalStep;
	private ELink editPriceStep;
	private ELink priceEvalStep;
	private ELink billEvalStep;
	private ELink recommendRankStep;
	private ELink vetoBidEvalStep;
	private ELink recommendEvalStep;
	private ELink setDefaultEvalStepBtn;
	private ELink applyToOtherPackBtn;
	private TenderProjectEntity tenderProjectEntity;
	private EvaluationStepOperatorShell operShell;
	private Map<Integer, StepButton> evaltionNodeGLabelMap = new HashMap<Integer, StepButton>();
	private List<EvaluationStep> evaluationStepList;
	private EvaluationStepListener evaluationStepOperationListener;
	private CallBack addNewCallBack;
	private CallBack updateCallBack;
	private EvaluationStepService evaluationStepService = new EvaluationStepService();
	private EvaluationGroupService evaluationGroupService = new EvaluationGroupService();
	private EvaluationFactorService evaluationFactorService = new EvaluationFactorService();
	private boolean hasSignNode = false;
	private boolean hasRecommendNode = false;
	private boolean isInEvaluationProgess = false;
	private TenderProjectRuleEntity tenderProjectRuleEntity;
	private Composite result_load_composite;
	private ELink show_evaluation_step_result;
	private Composite composite_1;
	private ELink moreOperateBtn;
	private StepButton curStep;
	private ELink creditEvalStep;
	private ELink totalPriceEvalStep;
	private ELink preEvaluationStep;
	private Menu menu;
	private MenuFunctionUtils menuFunctionUtils = new  MenuFunctionUtils();
	private BidPriceHisResultService bidPriceHisResultService;
	private Action projectAction;
	private TenderProjectService tenderProjectService;
	private Composite stepComposite;
	private TipsComposite tipsComposite;

	{
		LogUtils.logClass(EvaluationStepManagerComposite.class);
	}

	static {
		/**
		 * 第三层验证
		 * **/
		try {
			// 这是公钥
			String publicKey = "308201b83082012c06072a8648ce3804013082011f02818100fd7f53811d75122952df4a9c2eece4e7f611b7523cef4400" +
					"c31e3f80b6512669455d402251fb593d8d58fabfc5f5ba30f6cb9b556cd7813b801d346ff26660b76b9950a5a49f9fe8047b1022c24fbb" +
					"a9d7feb7c61bf83b57e7c6a8a6150f04fb83f6d3c51ec3023554135a169132f675f3ae2b61d72aeff22203199dd14801c70215009760508f" +
					"15230bccb292b982a2eb840bf0581cf502818100f7e1a085d69b3ddecbbcab5c36b857b97994afbbfa3aea82f9574c0b3d0782675159578e" +
					"bad4594fe67107108180b449167123e84c281613b7cf09328cc8a6e13c167a8b547c8d28e0a3ae1e2bb3a675916ea37f0bfa213562f1fb627a" +
					"01243bcca4f1bea8519089a883dfe15ae59f06928b665e807b552564014c3bfecf492a0381850002818100def368b8757ce205e46b76640e4886c" +
					"bd1604753a90cb07527b834a65e83b4f21b97ef443097e882e7c18dea3daea499e31201fa8e4df0f36b0cc00a64a01ccdd831f2856b7549f0eae5d7" +
					"150fe5800e40bb3b25e3b2a38c51b3f07edd6c90b6f3db70ac12bc11d480cbcaa23a9f30f4db77c0928f3faf477f5e672f43a42a73";
			
			byte pub[] = com.gx.security.CertUtil.decodeHex(publicKey);
			java.security.spec.X509EncodedKeySpec pubKeySpec = new java.security.spec.X509EncodedKeySpec(pub);
			java.security.KeyFactory keyFactory = java.security.KeyFactory.getInstance(com.gx.security.CertEnum.KEY_INIT_CODE);
			java.security.PublicKey pubKey = keyFactory.generatePublic(pubKeySpec);
			java.security.Signature sig = java.security.Signature.getInstance(com.gx.security.CertEnum.SIGN_RNG_NAME);/* 建立一个签名并用公共密钥初始化 */
			sig.initVerify(pubKey);
			// 这里指定license文件
			File licenseFile = new File(FileConstants.PRODUCT_ROOT + com.gx.security.CertValidator.getInstance().getSequence() + ".cer");
			BufferedReader in = new BufferedReader(new FileReader(licenseFile));
			String certificateXml = com.gx.security.CertUtil.decodeBase64(in.readLine());// 解码
			in.close();
			com.gx.security.Cert certificate = com.gx.security.CertUtil.fromXML(certificateXml);// 从xml读取license
			sig.update(certificate.getSignnatureData());/* 更新并校验数据 */
			boolean flag = sig.verify(com.gx.security.CertUtil.decodeHex(certificate.getSignature()));
			if (!flag) {
				throw new com.gx.security.SecurityRuntimeException("您的授权证书无效 ，请与" + certificate.getIssuer() + "联系。");
			}
			if (certificate.getExpiresDate().before(com.gx.security.NowTimeUtils.getNowDate())) {
				throw new com.gx.security.SecurityRuntimeException("您的授权证书已过期，请与" + certificate.getIssuer() + "联系。");
			}
			boolean valMac = true;
			// 如果是试用版本则不需要验证mac
			if (certificate.getCertType().getType().equals(com.gx.security.Cert.CertType.TRIAL.getType())) {
				valMac = false;
			}
			if (valMac && null != certificate.getMotherBoardSN()) {
				if (!certificate.getMotherBoardSN().contains(com.gx.security.CertValidator.getInstance().getMotherBoardSN())) {
					throw new com.gx.security.SecurityRuntimeException("不是当前设备SN的授权文件，请与" + certificate.getIssuer() + "联系。");
				}
			}
			if (valMac && null != certificate.getMac()) {
				if (!certificate.getMac().contains(com.gx.security.CertValidator.getInstance().getMac())) {
					throw new com.gx.security.SecurityRuntimeException("不是当前设备的授权文件，请与" + certificate.getIssuer() + "联系。");
				}
			}
		} catch (Exception e) {
			throw new com.gx.security.SecurityRuntimeException(e);
		}
	}

	/**
	 * Create the composite.
	 * 
	 * @param parent
	 * @param style
	 */
	public EvaluationStepManagerComposite(Composite parent, Action projectAction, int style) {
		super(parent, style);
		this.projectAction = projectAction;
		this.tenderProjectEntity = projectAction.getTenderProject();
		addDisposeListener(new DisposeListener() {
			public void widgetDisposed(DisposeEvent e) {
				imageResolver.disposite();
			}
		});
		GridLayout gridLayout = new GridLayout(1, false);
		gridLayout.marginHeight = 0;
		gridLayout.marginWidth = 0;
		setLayout(gridLayout);

//		Composite tipsComposite = new Composite(this, SWT.NONE);
//		tipsComposite.setLayout(new GridLayout(2, false));
//		tipsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
//		tipsComposite.setBackgroundMode(SWT.INHERIT_FORCE);
//		tipsComposite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
//		
//		CLabel tips = new CLabel(tipsComposite, SWT.NONE);
//		tips.setFont(SWTResourceManager.getFont("微软雅黑", 10, SWT.NORMAL));
//		tips.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/tips_blue.png"));
//		tips.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true, 1, 1));
//		tips.setText("");
		tipsComposite = new TipsComposite(this, SWT.NONE);
		tipsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
		tipsComposite.setBackground(SWTResourceManager.getColor(252, 252, 238));
		menuFunctionUtils.addFunction(tipsComposite, "STEP_TIPS");
		
		composite_1 = new Composite(this, SWT.NONE);
		RowLayout rl_composite_1 = new RowLayout(SWT.HORIZONTAL);
		rl_composite_1.spacing = 0;
		composite_1.setLayout(rl_composite_1);
		composite_1.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, false, 1, 1));
		composite_1.setBackgroundMode(SWT.INHERIT_FORCE);
		composite_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));

		setDefaultEvalStepBtn = new ELink(composite_1, SWT.NONE);
		setDefaultEvalStepBtn.setText(Messages.Button_createStep);
		setDefaultEvalStepBtn.setLayoutData(new RowData());
		setDefaultEvalStepBtn.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
		setDefaultEvalStepBtn.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				configDefaultEvaluationStepAction();
			}
		});
		menuFunctionUtils .addFunction(setDefaultEvalStepBtn, "CREATE_STEP");
		
		applyToOtherPackBtn = new ELink(composite_1, SWT.NONE);
		applyToOtherPackBtn.setText(Messages.Button_applyToOthers);
		applyToOtherPackBtn.setLayoutData(new RowData());
		applyToOtherPackBtn.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/copy.png"));
		applyToOtherPackBtn.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				applyToOtherPackAction();
			}
		});
		menuFunctionUtils .addFunction(applyToOtherPackBtn, "APPLY_OTHER");

		signEvalStep = new ELink(composite_1, SWT.NONE);
		signEvalStep.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				addSignNodeAction();
			}
		});
		signEvalStep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
		signEvalStep.setText(Messages.Step_signIn);
		signEvalStep.setLayoutData(new RowData());
		menuFunctionUtils .addFunction(signEvalStep, "SIGN_STEP");

		featureCheckStep = new ELink(composite_1, SWT.NONE);
		featureCheckStep.setText(Messages.Step_feature);
		featureCheckStep.setLayoutData(new RowData());
		featureCheckStep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
		featureCheckStep.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				addFeatureCheckNodeAction();
			}
		});
		menuFunctionUtils .addFunction(featureCheckStep, "FEATURE_CHECK");
		
		tianYanCheckStep = new ELink(composite_1, SWT.NONE);
		tianYanCheckStep.setText("关联关系评审");
		tianYanCheckStep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
		tianYanCheckStep.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				addTianYanCheckNodeAction();
			}
		});
		menuFunctionUtils .addFunction(featureCheckStep, "TIANYAN_CHECK");

		totalPriceEvalStep = new ELink(composite_1, SWT.NONE);
		totalPriceEvalStep.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				addTotalPriceEvaluationStepAction();
			}
		});
		totalPriceEvalStep.setText(Messages.Step_checkPrice);
		totalPriceEvalStep.setLayoutData(new RowData());
		totalPriceEvalStep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
		menuFunctionUtils .addFunction(totalPriceEvalStep, "TOTAL_PRICE");
		
		cleanTenderStep = new ELink(composite_1, SWT.NONE);
		cleanTenderStep.setText(Messages.Step_billCheck);
		cleanTenderStep.setLayoutData(new RowData());
		cleanTenderStep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
		cleanTenderStep.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				addCleanTenderNodeAction();
			}
		});
		menuFunctionUtils .addFunction(cleanTenderStep, "CLEAN_TENDER");
		
		limitPriceStep = new ELink(composite_1, SWT.NONE);
		limitPriceStep.setText(Messages.Step_limitPrice);
		limitPriceStep.setLayoutData(new RowData());
		limitPriceStep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
		limitPriceStep.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				addLimitPriveNodeAction();
			}
		});
		menuFunctionUtils .addFunction(limitPriceStep, "LIMIT_PRICE");
		
		preEvaluationStep = new ELink(composite_1, SWT.NONE);
		preEvaluationStep.setText(Messages.Step_bidComment);
		preEvaluationStep.setLayoutData(new RowData());
		preEvaluationStep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
		preEvaluationStep.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				addPreEvaluationNodeAction();
			}
		});
		menuFunctionUtils .addFunction(preEvaluationStep, "PRE_STEP");

		complianceEvalStep = new ELink(composite_1, SWT.NONE);
		complianceEvalStep.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				addComplianceEvaluationStepAction();
			}
		});
		complianceEvalStep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
		complianceEvalStep.setText(Messages.Step_compliance);
		complianceEvalStep.setLayoutData(new RowData());
		menuFunctionUtils .addFunction(complianceEvalStep, "COMPLIANCE_STEP");

		detailEvalStep = new ELink(composite_1, SWT.NONE);
		detailEvalStep.setText(Messages.Step_score);
		detailEvalStep.setLayoutData(new RowData());
		detailEvalStep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
		detailEvalStep.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				addScoreEvaluationStepAction();
			}
		});
		menuFunctionUtils .addFunction(detailEvalStep, "DETAIL_STEP");

		if (null != tenderProjectEntity && StringUtils.equals(TenderProjectEnum.TENDER_YTPE_JZGC, tenderProjectEntity.getTenderType())) {
			billEvalStep = new ELink(composite_1, SWT.NONE);
			billEvalStep.addMouseListener(new MouseAdapter() {
				public void mouseUp(MouseEvent e) {
					addBillEvaluationStepAction();
				}
			});
			billEvalStep.setText(Messages.Step_bill);
			billEvalStep.setLayoutData(new RowData());
			billEvalStep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
			menuFunctionUtils .addFunction(billEvalStep, "BILL_STEP");
		}
		
		creditEvalStep = new ELink(composite_1, SWT.NONE);
		creditEvalStep.setText(Messages.Step_credit);
		creditEvalStep.setLayoutData(new RowData());
		creditEvalStep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
		creditEvalStep.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				addCreditEvaluationStepAction();
			}
		});
		menuFunctionUtils .addFunction(creditEvalStep, "CREDIT_STEP");

		
		multiWheelPriceEvalStep = new ELink(composite_1, SWT.NONE);
		multiWheelPriceEvalStep.setText(Messages.Step_multiPrice);
		multiWheelPriceEvalStep.setLayoutData(new RowData());
		multiWheelPriceEvalStep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
		multiWheelPriceEvalStep.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				addMultiWheelPriceEvaluationStepAction();
			}
		});
		menuFunctionUtils .addFunction(multiWheelPriceEvalStep, "MULTI_STEP");
		
		editPriceStep = new ELink(composite_1, SWT.NONE);
		editPriceStep.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				addEditPriceStepAction();
			}
		});
		editPriceStep.setText(Messages.Step_editPrice);
		editPriceStep.setLayoutData(new RowData());
		editPriceStep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
		menuFunctionUtils .addFunction(editPriceStep, "EDIT_PRICE");
		
		priceEvalStep = new ELink(composite_1, SWT.NONE);
		priceEvalStep.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				addPriceEvaluationStepAction();
			}
		});
		priceEvalStep.setText(Messages.Step_price);
		priceEvalStep.setLayoutData(new RowData());
		priceEvalStep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
		menuFunctionUtils .addFunction(priceEvalStep, "PRICE_STEP");
		
		recommendRankStep = new ELink(composite_1, SWT.NONE);
		recommendRankStep.setText(Messages.Step_recommonedSort);
		recommendRankStep.setLayoutData(new RowData());
		recommendRankStep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
		recommendRankStep.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				addRecommendRankNodeAction();
			}
		});
		menuFunctionUtils .addFunction(recommendRankStep, "RECOMMEND_STEP");
		
		vetoBidEvalStep = new ELink(composite_1, SWT.NONE);
		vetoBidEvalStep.setText(Messages.Step_reject);
		vetoBidEvalStep.setLayoutData(new RowData());
		vetoBidEvalStep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
		vetoBidEvalStep.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				addVetoBidEvaluationStepAction();
			}
		});
		menuFunctionUtils .addFunction(vetoBidEvalStep, "VETO_STEP");
		
		recommendEvalStep = new ELink(composite_1, SWT.NONE);
		recommendEvalStep.setText(Messages.Step_recommoned);
		recommendEvalStep.setLayoutData(new RowData());
		recommendEvalStep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/add.png"));
		recommendEvalStep.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				addRecommonedEvaluationStepAction();
			}
		});
		menuFunctionUtils .addFunction(recommendEvalStep, "RECOMMENDEVAL_STEP");

		moreOperateBtn = new ELink(composite_1, SWT.NONE);
		moreOperateBtn.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/arrow_down_simp.png"));
		moreOperateBtn.setText(Messages.Button_moreOperate);
		moreOperateBtn.setLayoutData(new RowData());
		moreOperateBtn.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				moreOperation();
			}
		});
		menuFunctionUtils .addFunction(moreOperateBtn, "REFRESH");

		ScrolledComposite scrolledComposite = new ScrolledComposite(this, SWT.H_SCROLL | SWT.V_SCROLL);
		scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		scrolledComposite.setExpandHorizontal(true);
		scrolledComposite.setExpandVertical(true);

		Composite scrolledContentComposite = new Composite(scrolledComposite, SWT.NONE);

		GridLayout gl_composite = new GridLayout(1, false);
		gl_composite.marginHeight = 1;
		gl_composite.marginWidth = 1;
		scrolledContentComposite.setLayout(gl_composite);

		sashForm = new SashForm(scrolledContentComposite, SWT.SMOOTH | SWT.VERTICAL);
		sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		sashForm.setBackground(SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY));
		sashForm.setBackground(ColorConstants.SEP_LIGHT_COLOR);
		
		stepComposite = new Composite(sashForm, SWT.NONE);
		stepComposite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		GridLayout gl_stepComposite = new GridLayout(1, false);
		gl_stepComposite.marginWidth = 1;
		gl_stepComposite.marginHeight = 1;
		stepComposite.setLayout(gl_stepComposite);

		evaluationStepComposite = new Composite(stepComposite, SWT.NONE);
		evaluationStepComposite.setLayout(new RowLayout(SWT.HORIZONTAL));
		evaluationStepComposite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true, 1, 1));

		Composite composite_2 = new Composite(stepComposite, SWT.NONE);
		composite_2.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1));
		GridLayout gl_composite_2 = new GridLayout(1, false);
		gl_composite_2.marginHeight = 0;
		gl_composite_2.marginWidth = 0;
		composite_2.setLayout(gl_composite_2);

		show_evaluation_step_result = new ELink(composite_2, SWT.NONE);
		show_evaluation_step_result.setShowSubLine(false);
		show_evaluation_step_result.addMouseListener(new MouseAdapter() {
			public void mouseUp(MouseEvent e) {
				sashForm.setMaximizedControl(null == sashForm.getMaximizedControl() ? stepComposite : null);
				showOrHiddenViesAction();
			}
		});
		show_evaluation_step_result.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/arrow_down.png"));
		show_evaluation_step_result.setText(Messages.Button_hiddenInterfaceEffect);
		menuFunctionUtils .addFunction(show_evaluation_step_result, "SHOW_EVALUATION_STEP_RESULT");

		Composite evaluationStepDetailComposite = new Composite(sashForm, SWT.NONE);
		evaluationStepDetailComposite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		GridLayout gl_evaluationStepDetailComposite = new GridLayout(1, false);
		gl_evaluationStepDetailComposite.marginWidth = 0;
		gl_evaluationStepDetailComposite.marginHeight = 0;
		evaluationStepDetailComposite.setLayout(gl_evaluationStepDetailComposite);

		Composite composite_3 = new Composite(evaluationStepDetailComposite, SWT.NONE);
		GridLayout gl_composite_3 = new GridLayout(1, false);
		gl_composite_3.verticalSpacing = 0;
		gl_composite_3.horizontalSpacing = 0;
		gl_composite_3.marginWidth = 0;
		gl_composite_3.marginHeight = 0;
		composite_3.setLayout(gl_composite_3);
		composite_3.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

		result_load_composite = new Composite(composite_3, SWT.NONE);
		FillLayout fl_detailComposite = new FillLayout(SWT.HORIZONTAL);
		fl_detailComposite.marginHeight = 10;
		result_load_composite.setLayout(fl_detailComposite);
		result_load_composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		sashForm.setWeights(new int[] { 4, 6 });

		scrolledComposite.setContent(scrolledContentComposite);
		scrolledComposite.setMinSize(scrolledContentComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

		init();
	}

	/**
	 * @Description: 添加天眼查
	 * @author wangx
	 */
	private void addTianYanCheckNodeAction() {
		if (tianYanCheckStep.getEnabled()) {
			if (isInEvaluationProgress()) {
				return;
			}
			TianYanEvaluationStepDialog dialog = new TianYanEvaluationStepDialog(getShell(), tenderProjectEntity, null);
			dialog.setCallBack(addNewCallBack);
			dialog.open();
		}
	}

	/**
	 * @Description: 初始化
	 * @author guoyr
	 */
	private void init() {
		
		if (null == tenderProjectEntity || !StringUtils.equals(TenderProjectEnum.TENDER_YTPE_JZGC, tenderProjectEntity.getTenderType())) {
            WidgetUtils.setControlVisible(cleanTenderStep, false);
        }
		
		this.menu = projectAction.getMenu();
		tenderProjectService = new TenderProjectService();
		tenderProjectRuleEntity = projectAction.getTenderProjectRule();
		sashForm.setMaximizedControl(stepComposite);
		applyToOtherPackBtn.setText(MessageFormat.format(Messages.Button_applyToOthers, com.gx.obe.components.core.I18N.getString(I18NEnum.SUBPACKAGE, tenderProjectEntity.getTenderType())));
		WidgetUtils.setControlVisible(applyToOtherPackBtn, null != tenderProjectEntity.getParentId());
		tipsComposite.addTips(Messages.Tips_step1);
		tipsComposite.addTips(Messages.Tips_step2);
		tipsComposite.addTips(Messages.Tips_step3);
		
		menuFunctionUtils.initFunctionAuthority(menu);
		addEvaluationStepListener();
		refreshEvaluationStepList(null);
		
		// TODO 暂时不支持以下评标步骤
		WidgetUtils.setControlVisible(creditEvalStep, false);
		WidgetUtils.setControlVisible(totalPriceEvalStep, false);
		WidgetUtils.setControlVisible(editPriceStep, false);
		WidgetUtils.setControlVisible(recommendRankStep, false);
	}

	/**
	 * @Description: 添加评审步骤回调监听
	 * @author guoyr
	 */
	private void addEvaluationStepListener() {
		evaluationStepOperationListener = new EvaluationStepListener() {

			public void movePre(EvaluationStep evaluationStep) {
				moveEvaluationStepAction(evaluationStep, -1);
			}

			public void moveNext(EvaluationStep evaluationStep) {
				moveEvaluationStepAction(evaluationStep, 1);
			}

			public void edit(EvaluationStep evaluationStep) {
				editEvaluationStepAction(evaluationStep);
			}

			public void delete(final EvaluationStep evaluationStep) {
				if (MessageDialog.openConfirm(getShell(), Messages.Dialog_warmTips, MessageFormat.format(Messages.Tips_deleteObj, evaluationStep.getStepName()))) {
					if (evaluationStepService.deleteEvaluationStep(evaluationStep)) {
						new SyncThread(new SyncThread.Runnable() {
							public void run(){
								if(evaluationStep.getStepType().equals(EvaluationStepEnum.MULTI_ROUNDS_PRICE)){
									if(null == bidPriceHisResultService){
										bidPriceHisResultService = new BidPriceHisResultService();
									}
									bidPriceHisResultService.deleteBidPrcieByTenderId(evaluationStep.getTenderId());
								}
								Display.getDefault().syncExec(new Runnable(){
									public void run(){
										refreshEvaluationStepList(null);								
									}
								});
							}
						}).start();
						
					}
				}
			}
		};

		addNewCallBack = new CallBack() {
			public void callBackObject(Object obj) {
				EvaluationStep evaluationStep = (EvaluationStep) obj;
				List<EvaluationStep> updateSortEvaluationStepList = new ArrayList<EvaluationStep>();
				int insertSortNo = evaluationStepList.size() + 1;
				int insertIndex = evaluationStepList.size();
				// 如果是签到步骤，则需要将签到步骤调整到第一位
				if (evaluationStep.getStepType().equals(EvaluationStepEnum.SIGIN)) {
					insertSortNo = 1;
					insertIndex = 0;
				} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.FEATURE_CHECK)) {
					// 如果是特征码检查步骤
					for (int i = 0; i < evaluationStepList.size(); i++) {
						EvaluationStep _valuationNode = evaluationStepList.get(i);
						// 如果检测到签到步骤，则放到签到之后
						if (_valuationNode.getStepType().equals(EvaluationStepEnum.SIGIN)) {
							insertSortNo = _valuationNode.getSortNo() + 1;
							insertIndex = i + 1;
							break;
						}
					}
				} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.CLEAN_TENDER)) {
					// 如果是清标步骤
					for (int i = evaluationStepList.size() - 1; i >= 0; i--) {
						EvaluationStep _valuationNode = evaluationStepList.get(i);
						// 放到特征码检查或签到之后
						if (_valuationNode.getStepType().equals(EvaluationStepEnum.SIGIN) || _valuationNode.getStepType().equals(EvaluationStepEnum.FEATURE_CHECK)) {
							insertSortNo = _valuationNode.getSortNo() + 1;
							insertIndex = i + 1;
							break;
						}
					}
				} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.BID_PRICE_LIMIT)) {
					// 如果是限价评审步骤
					if (null != tenderProjectRuleEntity.getBidOpeningStage() && TenderProjectEnum.BID_OPENING_TWO_STAGE.equals(tenderProjectRuleEntity.getBidOpeningStage())) {
						for (int i = evaluationStepList.size() - 1; i >= 0; i--) {
							EvaluationStep _valuationNode = evaluationStepList.get(i);
							// 如果分两步开标，则需要把限价放到价格评审前
							if (_valuationNode.getStepType().equals(EvaluationStepEnum.PRICE)) {
								insertIndex = i;
								insertSortNo = _valuationNode.getSortNo();
								break;
							}
							// 如果未检则到价格步骤，则放到签到或是特征码检查之后
							if (_valuationNode.getStepType().equals(EvaluationStepEnum.SIGIN) || _valuationNode.getStepType().equals(EvaluationStepEnum.FEATURE_CHECK)) {
								insertSortNo = _valuationNode.getSortNo() + 1;
								insertIndex = i + 1;
								break;
							}
						}
					} else {
						for (int i = 0; i < evaluationStepList.size(); i++) {
							EvaluationStep _valuationNode = evaluationStepList.get(i);
							
							// 如果一步开标，则需要把限价放到签到之后
							if (_valuationNode.getStepType().equals(EvaluationStepEnum.SIGIN)) {
								insertSortNo = _valuationNode.getSortNo() + 1;
								insertIndex = i + 1;
							}
							// 如果一步开标，如果存在特征码检查，则放到特征码之后
							if (_valuationNode.getStepType().equals(EvaluationStepEnum.FEATURE_CHECK)) {
								insertSortNo = _valuationNode.getSortNo() + 1;
								insertIndex = i + 1;
								break;
							}
						}
					}
				} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.MULTI_ROUNDS_PRICE)) {
					for (int i = evaluationStepList.size() - 1; i >= 0; i--) {
						EvaluationStep _valuationNode = evaluationStepList.get(i);
						// 如果分两步开标，则需要把限价放到价格评审前
						if (_valuationNode.getStepType().equals(EvaluationStepEnum.PRICE)) {
							insertIndex = i;
							insertSortNo = _valuationNode.getSortNo();
							break;
						}
					}
				} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.TOTAL_PRICE)) {
					//核量评审
					for (int i = evaluationStepList.size() - 1; i >= 0; i--) {
						EvaluationStep _valuationNode = evaluationStepList.get(i);
						// 如果分两步开标，则需要把限价放到价格评审前
						if (_valuationNode.getStepType().equals(EvaluationStepEnum.PRICE)) {
							insertIndex = i;
							insertSortNo = _valuationNode.getSortNo();
							break;
						}
					}
				} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.PRE_EVALUATION)) {
					// 如果是清标步骤
					for (int i = evaluationStepList.size() - 1; i >= 0; i--) {
						EvaluationStep _valuationNode = evaluationStepList.get(i);
						// 放到特征码检查或签到之后
						if (_valuationNode.getStepType().equals(EvaluationStepEnum.SIGIN) 
								|| _valuationNode.getStepType().equals(EvaluationStepEnum.PRE_EVALUATION) 
								|| _valuationNode.getStepType().equals(EvaluationStepEnum.FEATURE_CHECK)) {
							insertSortNo = _valuationNode.getSortNo() + 1;
							insertIndex = i + 1;
							break;
						}
					}
				} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.EDIT_PRICE)) {
					// 如果是清标步骤
					for (int i = evaluationStepList.size() - 1; i >= 0; i--) {
						EvaluationStep _valuationNode = evaluationStepList.get(i);
						// 放到价格评审之前
						if (_valuationNode.getStepType().equals(EvaluationStepEnum.PRICE)) {
							insertIndex = i;
							insertSortNo = _valuationNode.getSortNo();
							break;
						}
					}
				}
				
				evaluationStep.setSortNo(insertSortNo);
				updateSortEvaluationStepList.add(evaluationStep);
				// 插入节点后的所有步骤往后移
				for (int i = insertIndex; i < evaluationStepList.size(); i++) {
					EvaluationStep _valuationNode = evaluationStepList.get(i);
					_valuationNode.setSortNo(_valuationNode.getSortNo() + 1);// 记录要往后移的步骤
					updateSortEvaluationStepList.add(_valuationNode);
				}
				evaluationStepService.batchUpdateProperty(updateSortEvaluationStepList, new String[] { "sortNo" });
				refreshEvaluationStepList(evaluationStep);
				// 如果存在推荐步骤并且当前步骤是最后一个步骤，则需要和推荐步骤交换
				if (hasRecommendNode && evaluationStep.getSortNo() == evaluationStepList.size() && !evaluationStep.getStepType().equals(EvaluationStepEnum.RECOMMONED)) {
					evaluationStepOperationListener.movePre(evaluationStep);
				}
			}
		};

		updateCallBack = new CallBack() {
			@Override
			public void callBackObject(Object obj) {
				EvaluationStep evaluationStep = (EvaluationStep) obj;
				StepButton sourceLabel = evaltionNodeGLabelMap.get(evaluationStep.getSortNo());
				sourceLabel.setText(evaluationStep.getStepName());
				evaluationStepComposite.layout();
				evaluationStepComposite.getParent().layout();
				if (ObjectUtils.equals(evaluationStep.getStepStatus(), CommonEnum.COMPLETE)) {
					sourceLabel.setSubImage(imageResolver.loadImage(IconsActivator.PLUGIN_ID, "icons/evaluaton_step/complate.png"));
				} else if (ObjectUtils.equals(evaluationStep.getStepStatus(), CommonEnum.IN_PROGRESS)) {
					sourceLabel.setSubImage(imageResolver.loadImage(IconsActivator.PLUGIN_ID, "icons/evaluaton_step/inprogress.png"));
				}
				loadEvaluationResultComposite(evaluationStep, sourceLabel);
			}
		};
	}

	/**
	 * @Description: 移动评审步骤
	 * @author guoyr
	 * @param step
	 * @param changeType -1：向前移；1：向后移
	 */
	private void moveEvaluationStepAction(EvaluationStep step, int changeType) {
		if (null == step) return;
		// GLabel sourceLabel = evaltionNodeGLabelMap.get(sourceNode.getSortNo());
		StepButton targetLabel = evaltionNodeGLabelMap.get(step.getSortNo() + changeType);
		if(null != targetLabel){
			EvaluationStep targetNode = (EvaluationStep) targetLabel.getData("evaluationStep");
			// 交换两个评审步骤的顺序,在service里面交换了序号，所以在下面就不用再交换序号了
			if (evaluationStepService.changeEvaluationStepSortNo(step, targetNode)) {
				refreshEvaluationStepList(step);
				evaluationStepComposite.layout();
			}
		}
	}

	/**
	 * @Description: 刷新评标步骤
	 * @author guoyr
	 * @param curEvaluationStep
	 */
	private void refreshEvaluationStepList(final EvaluationStep curEvaluationStep) {
		evaltionNodeGLabelMap.clear();
		evaluationStepList = evaluationStepService.getEvaluationStepList(tenderProjectEntity.getId());
		if(evaluationStepComposite.isDisposed())return;
		sashForm.setMaximizedControl(stepComposite);
		showOrHiddenViesAction();
		for (Control control : evaluationStepComposite.getChildren()) {
			control.dispose();
		}
		hasSignNode = false;
		hasRecommendNode = false;
		featureCheckStep.setEnabled(true);
		if (null != cleanTenderStep && !cleanTenderStep.isDisposed()) {
			cleanTenderStep.setEnabled(true);
		}
		editPriceStep.setEnabled(true);
		priceEvalStep.setEnabled(true);
		limitPriceStep.setEnabled(true);
		recommendRankStep.setEnabled(true);
		totalPriceEvalStep.setEnabled(true);
		limitPriceStep.setEnabled(true);
		multiWheelPriceEvalStep.setEnabled(true);
		if (null != evaluationStepList && evaluationStepList.size() > 0) {
			int surroundMargin = 8;
			if (evaluationStepList.size() > 6) {
				surroundMargin = 6;
			}
			int nodeCount = 0;
			ImageButton evaluationSep = null;
			for (final EvaluationStep evaluationStep : evaluationStepList) {
				if(evaluationStepComposite.isDisposed())return;
				final StepButton evaluation_step = new StepButton(evaluationStepComposite, SWT.NONE);
				evaluation_step.setLayoutData(new RowData(80, SWT.DEFAULT));
				evaluation_step.setFont(SWTResourceManager.getFont("微软雅黑", 10, SWT.NORMAL));
				evaluation_step.setSurroundMargin(surroundMargin);
				evaluation_step.setImage(imageResolver.loadImage(IconsActivator.PLUGIN_ID, EvaluationStepEnum.getEvaluationStepIco(evaluationStep.getStepType())));
				evaluation_step.setText(evaluationStep.getStepName());
				evaluation_step.setData("evaluationStep", evaluationStep);
				evaltionNodeGLabelMap.put(evaluationStep.getSortNo(), evaluation_step);
				evaluation_step.addMouseListener(new MouseAdapter() {
					public void mouseUp(MouseEvent e) {
						showEevaluationStepOperator(evaluationStep, evaluation_step);
						loadEvaluationResultComposite(evaluationStep, evaluation_step);
					}
				});
				
				evaluationSep = new ImageButton(evaluationStepComposite, SWT.NONE | SWT.CENTER);
				evaluationSep.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/evaluaton_step/next.png"));
				evaluationSep.setSurroundColor(SWTResourceManager.getColor(60, 138, 226));
				evaluationSep.setSurroundMargin(5);
				evaluationSep.setLayoutData(new RowData(SWT.DEFAULT, 80));
				evaluationSep.setText("");
				
//				evaluation_step.setSubImage(imageResolver.loadImage(IconsActivator.PLUGIN_ID, "icons/evaluaton_step/inprogress.png"));
				
				if (CommonEnum.COMPLETE.equals(evaluationStep.getStepStatus())) {
//					evaluation_step.setSubTextSurroundColor(SWTResourceManager.getColor(77, 163, 19));
//					evaluation_step.setSubText("✔");
					evaluation_step.setSubText(Messages.Progress_complate);
//					evaluation_step.setSubImage(imageResolver.loadImage(IconsActivator.PLUGIN_ID, "icons/evaluaton_step/complate.png"));
				} else if (CommonEnum.IN_PROGRESS.equals(evaluationStep.getStepStatus())) {
//					evaluation_step.setSubImage(imageResolver.loadImage(IconsActivator.PLUGIN_ID, "icons/evaluaton_step/inprogress.png"));
					evaluation_step.setSubText(Messages.Progress_inProgress);
				}else if (CommonEnum.RE_OPERATOR.equals(evaluationStep.getStepStatus())) {
					evaluation_step.setSubTextSurroundColor(SWTResourceManager.getColor(255, 153, 0));
					evaluation_step.setSubText(Messages.Progress_reBack);
				}else {
					evaluation_step.setSubText(Messages.Progress_noStart);
				}
				
				if (null != curEvaluationStep) {
					if (curEvaluationStep.getId().equals(evaluationStep.getId())) {
						loadEvaluationResultComposite(evaluationStep, evaluation_step);
					}
				} else if (nodeCount == 0) {
					loadEvaluationResultComposite(evaluationStep, evaluation_step);
				}
				// 记录是否存在签到评审步骤
				if (evaluationStep.getStepType().equals(EvaluationStepEnum.SIGIN)) {
					hasSignNode = true;
				}
				// 记录是否存在推荐候选人步骤
				if (evaluationStep.getStepType().equals(EvaluationStepEnum.RECOMMONED)) {
					hasRecommendNode = true;
				}
				if (evaluationStep.getStepType().equals(EvaluationStepEnum.FEATURE_CHECK)) {
					featureCheckStep.setEnabled(false);
				}
				if (null != cleanTenderStep && !cleanTenderStep.isDisposed()) {
					if (evaluationStep.getStepType().equals(EvaluationStepEnum.CLEAN_TENDER)) {
						cleanTenderStep.setEnabled(false);
					}
				}
				if (evaluationStep.getStepType().equals(EvaluationStepEnum.EDIT_PRICE)) {
					editPriceStep.setEnabled(false);
				}
				if (evaluationStep.getStepType().equals(EvaluationStepEnum.PRICE)) {
					priceEvalStep.setEnabled(false);
				}
				if (evaluationStep.getStepType().equals(EvaluationStepEnum.BID_PRICE_LIMIT)) {
					limitPriceStep.setEnabled(false);
				}
				if (evaluationStep.getStepType().equals(EvaluationStepEnum.MULTI_ROUNDS_PRICE)) {
					multiWheelPriceEvalStep.setEnabled(false);
				}
				if (evaluationStep.getStepType().equals(EvaluationStepEnum.RECOMMONED_RANK)) {
					recommendRankStep.setEnabled(false);
				}
				if (evaluationStep.getStepType().equals(EvaluationStepEnum.TOTAL_PRICE)) {
					totalPriceEvalStep.setEnabled(false);
				}
				if (evaluationStep.getStepType().equals(EvaluationStepEnum.ASSOCIATION_QUERY)) {
					tianYanCheckStep.setEnabled(false);
				}
				nodeCount++;
			}
			if (null != evaluationSep && !evaluationSep.isDisposed()) {
				evaluationSep.dispose();
				evaluationSep = null;
			}
			
		} else {
			ImageButton addProblemFile = new ImageButton(evaluationStepComposite, SWT.BOTTOM);
			addProblemFile.setFillSurround(true);
			addProblemFile.setSurroundMargin(20);
			addProblemFile.setActiveSurroundColor(ColorConstants.SKIN_SELECTION_BG);
			addProblemFile.setSurroundColor(ColorConstants.SKIN_BG);
			addProblemFile.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/add_file.png"));
			addProblemFile.setFont(SWTResourceManager.getFont("微软雅黑", 15, SWT.NORMAL));
			addProblemFile.setForeground(ColorConstants.NOTE_TIPS_COLOR);
			addProblemFile.setText(Messages.Button_createStep);
			addProblemFile.addMouseListener(new MouseAdapter() {
				public void mouseUp(MouseEvent e) {
					configDefaultEvaluationStepAction();
				}
			});
			
			for (Control control : result_load_composite.getChildren()) {
				control.dispose();
			}
		}
		
		refreshAddStepBtnStatus();
		evaluationStepComposite.layout();
		evaluationStepComposite.getParent().layout();
	
	}
	
	/**
	 * @Description: 应用到其他包件
	 * @author guoyr 
	 */
	private void applyToOtherPackAction(){
		if(null != evaluationStepList && evaluationStepList.size() > 0){
			ApplyToOtherTenderPackDialog applyToOtherTenderPackDialog = new ApplyToOtherTenderPackDialog(getShell(), tenderProjectEntity, evaluationStepList);
			applyToOtherTenderPackDialog.open();
		}else {
			MessageDialog.openShortMessage(Messages.Tips_configStepFirst);
		}
	}
	
	/**
	 * @Description: 刷新添加评审步骤按钮的状态
	 * @author guoyr
	 */
	private void refreshAddStepBtnStatus() {
		signEvalStep.setEnabled(!hasSignNode);
		recommendEvalStep.setEnabled(!hasRecommendNode);
		// 符合性评审(如果没有可分配的评审指标，则不允许弹出创建步骤)
		List<EvaluationFactor> complianceFactorList = evaluationFactorService.getFactorListOfEvaluationStep(tenderProjectEntity.getId(), EvaluationFactorEnum.AUDIT_COMPLIANCE, null);
		if (null != complianceFactorList && complianceFactorList.size() > 0) {
			complianceEvalStep.setEnabled(true);
		} else {
			complianceEvalStep.setEnabled(false);
			complianceEvalStep.setToolTipText("未检测到可分配的符合性指标，因此不能创建符合性评审步骤！");
		}
		// 打分评审
		List<EvaluationFactor> detailFactorList = evaluationFactorService.getFactorListOfEvaluationStep(tenderProjectEntity.getId(), EvaluationFactorEnum.AUDIT_SCORE, null);
		if (null != detailFactorList && detailFactorList.size() > 0) {
			detailEvalStep.setEnabled(true);
		} else {
			detailEvalStep.setEnabled(false);
			detailEvalStep.setToolTipText("未检测到可分配的评分指标，因此不能创建打分评审步骤！");
		}
		// 二阶段评标法不需要进行价格评审
//		if (ObjectUtils.equals(tenderProjectRuleEntity.getEvalMethodType(), TenderProjectEnum.TWO_STAGE)) {
//			priceEvalStep.setEnabled(false);
//		}
	}

	/**
	 * @Description: 显示评标步骤的操作界面
	 * @author guoyr
	 * @param evaluationStep
	 * @param label
	 */
	private void showEevaluationStepOperator(EvaluationStep evaluationStep, StepButton label) {
		if (null != evaluationStep) {
			isInEvaluationProgess = false;
			// 单独查询评审结点的完成情况
			EvaluationStep qyeryEvaluationStep = evaluationStepService.getById(evaluationStep.getId());
			if (null != qyeryEvaluationStep) {
				evaluationStep.setStepStatus(qyeryEvaluationStep.getStepStatus());
				if (ObjectUtils.equals(evaluationStep.getStepStatus(), CommonEnum.COMPLETE) || ObjectUtils.equals(evaluationStep.getStepStatus(), CommonEnum.IN_PROGRESS)) {
					isInEvaluationProgess = true;
				}
			}

			if (!isInEvaluationProgess) {
				isInEvaluationProgess = tenderProjectService.isInProgress(tenderProjectEntity.getId(), null);
			}

			// 设置显示菜单栏的位置
			Point labelPoint = Display.getCurrent().map(label, null, 0, 0);
			Point parentPoint = evaluationStepComposite.getParent().toDisplay(0, 0);
			if (null != operShell && !operShell.isDisposed()) {
				operShell.close();
			}

			operShell = new EvaluationStepOperatorShell(this.getShell(), evaluationStep);
			operShell.pack();

			Rectangle bounds = operShell.getBounds();
			int operatorX = labelPoint.x - (bounds.width / 2) + label.getBounds().width / 2;
			if (operatorX < parentPoint.x) {
				operatorX = parentPoint.x;
			} else if (operatorX + bounds.width > parentPoint.x + evaluationStepComposite.getParent().getBounds().width) {
				operatorX = parentPoint.x + evaluationStepComposite.getParent().getBounds().width - bounds.width;
			}
			operShell.setLocation(operatorX, labelPoint.y - bounds.height);

			// 设置不可向前移动
			if (evaluationStep.getStepType().equals(EvaluationStepEnum.RECOMMONED)) {// 推荐步骤不能向前移
				operShell.setPreBtnEnable(false);
			} else if (evaluationStep.getSortNo() == 1) {// 已经是第一个评审步骤
				operShell.setPreBtnEnable(false);
			} else if (hasSignNode && evaluationStep.getSortNo() == 2) {// 存在签到步骤，并且当前步骤顺序为2
				operShell.setPreBtnEnable(false);
			}
			
			// 设置不可向后移动
			if (evaluationStep.getStepType().equals(EvaluationStepEnum.SIGIN)) {// 签到步骤不能向后移
				operShell.setNextBtnEnable(false);
			} else if (null != evaluationStepList && evaluationStepList.size() == evaluationStep.getSortNo()) {// 已经是最后一个步骤
				operShell.setNextBtnEnable(false);
			} else if (hasRecommendNode && evaluationStep.getSortNo() == evaluationStepList.size() - 1) {// 存在推荐步骤，且当前步骤是倒数第二个步骤
				operShell.setNextBtnEnable(false);
			}
			
			//多轮报价 如果是远程报价不可删除
			if (EvaluationStepEnum.REMOTE.equals(evaluationStep.getEvaluationParamByKey("BidPriceSource")) && evaluationStep.getStepType().equals(EvaluationStepEnum.MULTI_ROUNDS_PRICE)) {
				operShell.setDelBtnEnable(false);
			}
		
			// 如果已进入评标环节
			if (isInEvaluationProgess) {
				if (CommonEnum.IN_PROGRESS.equals(evaluationStep.getStepStatus()) || CommonEnum.COMPLETE.equals(evaluationStep.getStepStatus())) {
					operShell.setNextBtnEnable(false);
					operShell.setDelBtnEnable(false);
				}
				EvaluationStep step = evaluationStepService.getEvaluationStepBySortNo(tenderProjectEntity.getId(), evaluationStep.getSortNo() - 1);
				if (null != step) {
					if (CommonEnum.IN_PROGRESS.equals(step.getStepStatus()) || CommonEnum.COMPLETE.equals(step.getStepStatus())) {
						operShell.setPreBtnEnable(false);
					}
				}
			}
			operShell.addEvaluationStepListener(evaluationStepOperationListener);
			operShell.open();
		}
	}

	/**
	 * @Description: 显示结果界面效果
	 * @author guoyr
	 * @param evaluationStep
	 * @param stepBtn
	 */
	private void loadEvaluationResultComposite(EvaluationStep evaluationStep, StepButton stepBtn) {
		if(result_load_composite.isDisposed())return;
		if (null != curStep && !curStep.isDisposed()) {
			curStep.setSelection(false);
			curStep = null;
		}
		curStep = stepBtn;
		curStep.setData("evaluationStep", evaluationStep);
		curStep.setSelection(true);
		
		if(null != sashForm.getMaximizedControl()){
			return;
		}
		MenuService menuService = new MenuService();
		Menu resultMenu = menuService.getMenutByMenuCode(MenuEnum.EVALUATION_RESULT);
		if(null == resultMenu) {
			resultMenu = menu;
		}
		Action action = null;
		if (evaluationStep.getStepType().equals(EvaluationStepEnum.SIGIN)) {
			action = (Action) ActionUtil.getAction(ExpertSignResutlAction.class.getName());
		} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.COMPLIANCE)) {
			action = (Action) ActionUtil.getAction(ComplianceEvaluationResultAction.class.getName());
		} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.FEATURE_CHECK)) {
			action = (Action) ActionUtil.getAction(FeatureCodeCheckResultAction.class.getName());
		}  else if (evaluationStep.getStepType().equals(EvaluationStepEnum.ASSOCIATION_QUERY)) {
			action = (Action) ActionUtil.getAction(TianYanCheckResultAction.class.getName());
		} else if (EvaluationStepEnum.DETAIL.equals(evaluationStep.getStepType()) || EvaluationStepEnum.FIXED_FACTOR.equals(evaluationStep.getStepType())) {
			if(null != evaluationStep.getSummaryType() && evaluationStep.getSummaryType().equals(EvaluationStepEnum.SUMMARY_SCORE_BY_QUALIFIED)){
				action = (Action) ActionUtil.getAction(ComplianceEvaluationResultAction.class.getName());
			}else {
				action = (Action) ActionUtil.getAction(ScoreEvaluationResultAction.class.getName());
			}
		} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.MULTI_ROUNDS_PRICE)) {
			action = (Action) ActionUtil.getAction(MultiWheelPriceEvaluationResultAction.class.getName());
			action.setData("result", true);
		} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.TOTAL_PRICE)) {
			action = (Action) ActionUtil.getAction(TotalPriceEvaluationResultAction.class.getName());
		} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.EDIT_PRICE)) {
			action = (Action) ActionUtil.getAction(EditPriceResultAction.class.getName());
		} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.PRICE)) {
			action = (Action) ActionUtil.getAction(PriceEvaluationResultAction.class.getName());
		} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.RECOMMONED)) {
			action = (Action) ActionUtil.getAction(RecommonedEvaluationResultAction.class.getName());
			List<EvaluationStep> recommonedRankList = evaluationStepService.getEvaluationStepListByType(tenderProjectEntity.getId(), EvaluationStepEnum.RECOMMONED_RANK);
			if (null != recommonedRankList && recommonedRankList.size() > 0) {
				action.setData(EvaluationStepEnum.RECOMMONED_RANK, recommonedRankList.get(0));
			}
		} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.BID_PRICE_LIMIT)) {
			action = (Action) ActionUtil.getAction(LimitPriceEvaluationResultAction.class.getName());
		} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.RECOMMONED_RANK)) {
			action = (Action) ActionUtil.getAction(RecommendRankEvaluationResultAction.class.getName());
		} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.VETO_BID)) {
			action = (Action) ActionUtil.getAction(VetoBidEvaluationResultAction.class.getName());
		} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.CREDIT)) {
			action = (Action) ActionUtil.getAction(CreditEvaluationResultAction.class.getName());
		} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.WASTE_BID)) {
			action = (Action) ActionUtil.getAction(AbandonEvalutionAction.class.getName());
			action.setData("result", "result");
		} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.PRE_EVALUATION)) {
			action = (Action) ActionUtil.getAction(PreEvaluationResultAction.class.getName());
		}
		if (null != action) {
			action.addActionListener(this);
			action.setData("evaluationStep", evaluationStep);
			action.setMenu(resultMenu);
			action.setParentProject(tenderProjectEntity.getParentProjectEntity());
			action.setTenderProject(tenderProjectEntity);
			action.setTenderProjectRule(tenderProjectRuleEntity);
			action.setEvaluationStep(evaluationStep);
			action.run();
		}
	}

	public void moreOperation() {
//		MoreOperationListShell shell = new MoreOperationListShell(getShell(),(null != evaluationStepList && evaluationStepList.size() > 0) ? true : false);
//		Point p = Display.getDefault().map(refreshBtn, null, 0, 0);
//		shell.setDate(new Rectangle(p.x, p.y, refreshBtn.getBounds().width, refreshBtn.getBounds().height));
//		shell.addProjectOpListener(new MoreOperationListener() {
//			public void clearEvalNodeActionListener() {
//				clearEvaluationStepAction();
//			}
//		});
//		shell.setLocation(refreshBtn.toDisplay(0, refreshBtn.getBounds().height));
//		shell.pack();
//		shell.open();
		
		EOp supplierOp = new EOp(getShell());
//		supplierOp.addOpItem("设置默认名称", ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/config.png"), true, new EOp.ClickListener() {
//			public void click() {
//				editDefaultStepNameAction();
//			}
//		});
		supplierOp.addOpItem(Messages.Button_setStepTemplate, ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/config.png"), null != evaluationStepList && evaluationStepList.size() > 0, new EOp.ClickListener() {
			public void click() {
				configDefaultStepModelAction();
			}
		});
		
		final File templateFile = new File(Platform.getInstallLocation().getURL().getPath()+File.separator + FileConstants.DEFAULT_EVALUATION_STEP_FOLDER+File.separator + "evaluationStep.xml");
		supplierOp.addOpItem(Messages.Button_delStepTemplate, ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/delete.png"), templateFile.exists(), new EOp.ClickListener() {
			public void click() {
				templateFile.delete();
			}
		});
		supplierOp.addOpItem(Messages.Button_importStep, ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/import.png"), true, new EOp.ClickListener() {
			public void click() {
				importStepModelAction();
			}
		});
		supplierOp.addOpItem(Messages.Button_exportStep, ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/export.png"), null != evaluationStepList && evaluationStepList.size() > 0, new EOp.ClickListener() {
			public void click() {
				exportStepModelAction();
			}
		});
		
		supplierOp.setForeground(SWTResourceManager.getColor(80, 80, 80));
		supplierOp.addOpItem(Messages.Button_deleteAllStep, ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/delete.png"), true, new EOp.ClickListener() {
			public void click() {
				clearEvaluationStepAction();
			}
		});

		supplierOp.setBackground(SWTResourceManager.getColor(60, 138, 226));
		supplierOp.setAlpha(200);
		supplierOp.open(moreOperateBtn);
		
	}


	/**
	 * @Description: 设置为评标步骤模板
	 * @author guoyr 
	 */
	private void configDefaultStepModelAction(){
		if(null != evaluationStepList && evaluationStepList.size() > 0){
			boolean saveFlag = saveStepModelAction(Platform.getInstallLocation().getURL().getPath()+File.separator + FileConstants.DEFAULT_EVALUATION_STEP_FOLDER+File.separator + "evaluationStep.xml");
			MessageDialog.openShortMessage(saveFlag ? Messages.Tips_operateSuccess : Messages.Tips_operateFail);
		}
	}
	/**
	 * @Description: 导出评标步骤模板
	 * @author guoyr 
	 */
	private void exportStepModelAction(){
		if(null != evaluationStepList && evaluationStepList.size() > 0){
			String savePath = FileDialogUtils.getFileSavePath("evaluationStep.xml", Messages.Button_exportStep, new String[]{"*.xml"}, new String[]{"xml文件"});
			if(StringUtils.isNotEmpty(savePath)){
				boolean saveFlag = saveStepModelAction(savePath);
				MessageDialog.openShortMessage(saveFlag ? Messages.Tips_operateSuccess : Messages.Tips_operateFail);
			}
		}
	}
	/**
	 * @Description: 保存评标步骤模板
	 * @author guoyr
	 * @param savePath 
	 */
	private boolean saveStepModelAction(String savePath){
		if(null != evaluationStepList && evaluationStepList.size() > 0){
			Document document = DocumentHelper.createDocument();
			Element rootElement = document.addElement("evaluationStepModel");
			for(EvaluationStep evaluationStep : evaluationStepList){
				rootElement.add(XmlBeanUtils.objectToElement(evaluationStep));
			}
			if(StringUtils.isNotEmpty(savePath)){
				return XmlUtils.createXmlFile(document, savePath, "UTF-8");
			}
		}
		return false;
	}
	/**
	 * @Description: 导入评标步骤模板
	 * @author guoyr 
	 */
	private void importStepModelAction(){
		boolean isInEvaluationProgress = tenderProjectService.isInProgress(tenderProjectEntity.getId(), null);
		if (isInEvaluationProgress) {
			MessageDialog.openInformation(getShell(), Messages.Dialog_warmTips, Messages.Tips_enteredEvaluation);
			return;
		}
		if (null != evaluationStepList && evaluationStepList.size() > 0) {
			if (!MessageDialog.openConfirm(getShell(), Messages.Button_importStep, Messages.Tips_alreadyExistStep, Messages.Button_confirm, Messages.Button_cancel)) {
				return;
			}
		}
		String fileNames = FileDialogUtils.getFileNames(SWT.SINGLE, Messages.Button_importStep, new String[]{"*.xml"}, new String[]{"*.xml"});
		
		if(StringUtils.isNotEmpty(fileNames)){
			CreateEvaluationStepThread createEvaluationStepThread = new CreateEvaluationStepThread(tenderProjectEntity, fileNames, new CallBack(){
				public void callBack(final boolean flag, final Object message) {
					Display.getDefault().syncExec(new Runnable(){
						public void run(){
							if(!evaluationStepComposite.isDisposed()){
								if(flag){
									refreshEvaluationStepList(null);
								}else {
									MessageDialog.openError(getShell(), (String)message);
								}
							}
						}
					});
				}
			});
			createEvaluationStepThread.start();
		}
	}
	
	/**
	 * @Description: 添加签到步骤
	 * @author guoyr
	 */
	private void addSignNodeAction() {
		if (signEvalStep.getEnabled()) {
			if (isInEvaluationProgress()) {
				return;
			}
			AddExpertSignDialog dialog = new AddExpertSignDialog(getShell(), tenderProjectEntity, null);
			dialog.setCallBack(addNewCallBack);
			dialog.open();
		}
	}

	/**
	 * @Description: 添加特征码检查
	 * @author guoyr
	 */
	private void addFeatureCheckNodeAction() {
		if (featureCheckStep.getEnabled()) {
			if (isInEvaluationProgress()) {
				return;
			}
			FeatureEvaluationStepDialog dialog = new FeatureEvaluationStepDialog(getShell(), tenderProjectEntity, null);
			dialog.setCallBack(addNewCallBack);
			dialog.open();
		}
	}

	/**
	 * @Description: 添加清标评审步骤
	 * @author guoyr
	 */
	private void addCleanTenderNodeAction() {
		if (cleanTenderStep.getEnabled()) {
			if (isInEvaluationProgress()) {
				return;
			}
			CleanTenderEvaluationStepDialog dialog = new CleanTenderEvaluationStepDialog(getShell(), tenderProjectEntity, null);
			dialog.setCallBack(addNewCallBack);
			dialog.open();
		}
	}

//	/**
//     * @Description: 添加商务否决评审步骤
//     * @author chenxw 
//     */
//    private void addBusinessVetoEvaluationStepAction() {
//        if (!businessVetoEvalStep.getEnabled()) {
//            return;
//        }
//        if (isInEvaluationProgress()) {
//            return;
//        }
//        BusinessVetoEvaluationStepDialog dialog = new BusinessVetoEvaluationStepDialog(getShell(), tenderProjectEntity, null);
//        dialog.setCallBack(addNewCallBack);
//        dialog.open();
//    }
//    
//    /**
//     * @Description: 添加商务评审
//     * @author guoyr 
//     */
//    private void addBusinessEvaluationStepAction() {
//        if (!businessEvalStep.getEnabled()) {
//            return;
//        }
//        if (isInEvaluationProgress()) {
//            return;
//        }
//        BusinessEvaluationStepDialog dialog = new BusinessEvaluationStepDialog(getShell(), tenderProjectEntity, null);
//        dialog.setCallBack(addNewCallBack);
//        dialog.open();
//    }
	
	/**
	 * @Description: 添加预评审步骤
	 * @author chenxw 
	 */
	private void addPreEvaluationNodeAction() {
		if (preEvaluationStep.getEnabled()) {
			if (isInEvaluationProgress()) {
				return;
			}
			PreEvaluationStepDialog dialog = new PreEvaluationStepDialog(getShell(), tenderProjectEntity, null);
			dialog.setCallBack(addNewCallBack);
			dialog.open();
		}
	}
	
	/**
	 * @Description: 添加符合性评标步骤
	 * @author guoyr
	 */
	private void addComplianceEvaluationStepAction() {
		if (complianceEvalStep.getEnabled()) {
			if (isInEvaluationProgress()) {
				return;
			}
			ComplianceEvaluationStepDialog dialog = new ComplianceEvaluationStepDialog(getShell(), tenderProjectEntity, null);
			dialog.setCallBack(addNewCallBack);
			dialog.open();
		}
	}

	/**
	 * @Description: 添加打分步骤
	 * @author guoyr
	 */
	private void addScoreEvaluationStepAction() {
		if (detailEvalStep.getEnabled()) {
			if (isInEvaluationProgress()) {
				return;
			}
			ScoreEvaluationStepDialog dialog = new ScoreEvaluationStepDialog(getShell(), tenderProjectEntity, null);
			dialog.setCallBack(addNewCallBack);
			dialog.open();
		}
	}

	/**
	 * @Description: 添加多轮报价步骤
	 * @author guoyr
	 */
	private void addMultiWheelPriceEvaluationStepAction() {
		if (multiWheelPriceEvalStep.getEnabled()) {
			boolean isInEvaluationProgress = tenderProjectService.isInProgress(tenderProjectEntity.getId(), EvaluationStepEnum.PRICE);
			if (isInEvaluationProgress) {
				MessageDialog.openInformation(getShell(), Messages.Dialog_warmTips, Messages.Tips_enteredPriceEvaluation);
				return;
			}
			MultiRoundsPriceEvaluationStepDialog dialog = new MultiRoundsPriceEvaluationStepDialog(getShell(), tenderProjectEntity, null);
			dialog.setCallBack(addNewCallBack);
			dialog.open();
		}
	}
	
	/**
	 * @Description: 添加修正报价步骤
	 * @author chenxw 
	 */
	private void addEditPriceStepAction() {
		if (!editPriceStep.getEnabled()) return;
		if (isInEvaluationProgress()) return;
		EditPriceStepDialog dialog = new EditPriceStepDialog(getShell(), tenderProjectEntity, null);
		dialog.setCallBack(addNewCallBack);
		dialog.open();
	}
	
	/**
	 * @Description: 添加价格评审步骤
	 * @author guoyr
	 */
	private void addPriceEvaluationStepAction() {
		if (priceEvalStep.getEnabled()) {
			if (isInEvaluationProgress()) {
				return;
			}
			PriceScoreEvaluationStepDialog dialog = new PriceScoreEvaluationStepDialog(getShell(), tenderProjectEntity, tenderProjectRuleEntity, null);
			dialog.setCallBack(addNewCallBack);
			dialog.open();
		}
	}

	/**
	 * @Description: 添加清单评审
	 * @author chenxw 
	 */
	private void addBillEvaluationStepAction() {
		if (billEvalStep.getEnabled()) {
			if (isInEvaluationProgress()) {
				return;
			}
			String billType = PropertiesUtils.getProperty(ConfigConstants.BILL_TYPE, EvaluationStepEnum.BILL_ZBT);
			if (EvaluationStepEnum.BILL_ZBT.equals(billType)) {
				BillEvaluationStepDialog dialog = new BillEvaluationStepDialog(getShell(), tenderProjectEntity, null);
				dialog.setCallBack(addNewCallBack);
				dialog.open();
			} else if (EvaluationStepEnum.BILL_YT.equals(billType) || EvaluationStepEnum.BILL_BZ.equals(billType)) {
				EngineeringStepDialog dialog = new EngineeringStepDialog(getShell(), tenderProjectEntity, null);
				dialog.setCallBack(addNewCallBack);
				dialog.open();
			}
		}
	}
	
	/**
	 * @Description: 添加综合信用评审
	 * @author chenxw 
	 */
	private void addCreditEvaluationStepAction() {
		if (creditEvalStep.getEnabled()) {
			if (isInEvaluationProgress()) {
				return;
			}
			CreditEvaluationStepDialog dialog = new CreditEvaluationStepDialog(getShell(), tenderProjectEntity, null);
			dialog.setCallBack(addNewCallBack);
			dialog.open();
		}
	}
	
	/**
	 * @Description: 添加核量评审
	 * @author chenxw 
	 */
	private void addTotalPriceEvaluationStepAction() {
		if (totalPriceEvalStep.getEnabled()) {
			if (isInEvaluationProgress()) {
				return;
			}
			TotalPriceEvaluationStepDialog dialog = new TotalPriceEvaluationStepDialog(getShell(), tenderProjectEntity, null);
			dialog.setCallBack(addNewCallBack);
			dialog.open();
		}
	}
	
	/**
	 * @Description: 添加推荐中标候选人评标步骤
	 * @author guoyr
	 */
	private void addRecommonedEvaluationStepAction() {
		if (recommendEvalStep.getEnabled()) {
			if (isInEvaluationProgress()) {
				return;
			}
			RecommonedEvaluationStepDialog dialog = new RecommonedEvaluationStepDialog(getShell(), tenderProjectEntity, null);
			dialog.setCallBack(addNewCallBack);
			dialog.open();
		}
	}

	/**
	 * @Description: 添加限价评审步骤
	 * @author chenxw
	 */
	protected void addLimitPriveNodeAction() {
		if (limitPriceStep.getEnabled()) {
			if (isInEvaluationProgress()) {
				return;
			}
			LimitPriceEvaluationStepDialog dialog = new LimitPriceEvaluationStepDialog(getShell(), tenderProjectEntity, null);
			dialog.setCallBack(addNewCallBack);
			dialog.open();
		}
	}
	
	/**
	 * @Description: 添加推荐排名评审步骤
	 * @author chenxw
	 */
	protected void addRecommendRankNodeAction() {
		if (recommendRankStep.getEnabled()) {
			if (isInEvaluationProgress()) {
				return;
			}
			RecommendRankEvaluationStepDialog dialog = new RecommendRankEvaluationStepDialog(getShell(), tenderProjectEntity, null);
			dialog.setCallBack(addNewCallBack);
			dialog.open();
		}
	}
	
	/**
	 * @Description: 添加否决投标评审步骤
	 * @author chenxw 
	 */
	protected void addVetoBidEvaluationStepAction() {
		if (vetoBidEvalStep.getEnabled()) {
			if (isInEvaluationProgress()) {
				return;
			}
			VetoBidEvaluationStepDialog dialog = new VetoBidEvaluationStepDialog(getShell(), tenderProjectEntity, null);
			dialog.setCallBack(addNewCallBack);
			dialog.open();
		}
	}
	
	/**
	 * @Description: 评标步骤修改回调监听
	 * @author guoyr
	 * @param evaluationStep
	 */
	private void editEvaluationStepAction(EvaluationStep evaluationStep) {
		if (null != evaluationStep && StringUtils.isNotEmpty(evaluationStep.getStepType())) {
			if (evaluationStep.getStepType().equals(EvaluationStepEnum.SIGIN)) {
				AddExpertSignDialog dialog = new AddExpertSignDialog(getShell(), tenderProjectEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.FEATURE_CHECK)) {
				FeatureEvaluationStepDialog dialog = new FeatureEvaluationStepDialog(getShell(), tenderProjectEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			}  else if (evaluationStep.getStepType().equals(EvaluationStepEnum.ASSOCIATION_QUERY)) {
				TianYanEvaluationStepDialog dialog = new TianYanEvaluationStepDialog(getShell(), tenderProjectEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.CLEAN_TENDER)) {
				CleanTenderEvaluationStepDialog dialog = new CleanTenderEvaluationStepDialog(getShell(), tenderProjectEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.PRE_EVALUATION)) {
				PreEvaluationStepDialog dialog = new PreEvaluationStepDialog(getShell(), tenderProjectEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.COMPLIANCE)) {
				ComplianceEvaluationStepDialog dialog = new ComplianceEvaluationStepDialog(getShell(), tenderProjectEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.DETAIL) || EvaluationStepEnum.FIXED_FACTOR.equals(evaluationStep.getStepType())) {
				ScoreEvaluationStepDialog dialog = new ScoreEvaluationStepDialog(getShell(), tenderProjectEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.MULTI_ROUNDS_PRICE)) {
				MultiRoundsPriceEvaluationStepDialog dialog = new MultiRoundsPriceEvaluationStepDialog(getShell(), tenderProjectEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.EDIT_PRICE)) {
				EditPriceStepDialog dialog = new EditPriceStepDialog(getShell(), tenderProjectEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.TOTAL_PRICE)) {
				TotalPriceEvaluationStepDialog dialog = new TotalPriceEvaluationStepDialog(getShell(), tenderProjectEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.PRICE)) {
//				PriceEvaluationStepDialog dialog = new PriceEvaluationStepDialog(getShell(), tenderProjectEntity, tenderProjectRuleEntity, evaluationStep);
				PriceScoreEvaluationStepDialog dialog = new PriceScoreEvaluationStepDialog(getShell(), tenderProjectEntity, tenderProjectRuleEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.CREDIT)) {
				CreditEvaluationStepDialog dialog = new CreditEvaluationStepDialog(getShell(), tenderProjectEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.BUSINESS_VETO)) {
			    BusinessVetoEvaluationStepDialog dialog = new BusinessVetoEvaluationStepDialog(getShell(), tenderProjectEntity, evaluationStep);
                dialog.setCallBack(updateCallBack);
                dialog.open();
			} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.BILL)) {
			    BusinessEvaluationStepDialog dialog = new BusinessEvaluationStepDialog(getShell(), tenderProjectEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.BID_PRICE_LIMIT)) {
				LimitPriceEvaluationStepDialog dialog = new LimitPriceEvaluationStepDialog(getShell(), tenderProjectEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.RECOMMONED_RANK)) {
				RecommendRankEvaluationStepDialog dialog = new RecommendRankEvaluationStepDialog(getShell(), tenderProjectEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.VETO_BID)) {
				VetoBidEvaluationStepDialog dialog = new VetoBidEvaluationStepDialog(getShell(), tenderProjectEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			} else if (evaluationStep.getStepType().equals(EvaluationStepEnum.WASTE_BID)) {
				WasteBidStepDialog dialog = new WasteBidStepDialog(getShell(), tenderProjectEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			}else if (evaluationStep.getStepType().equals(EvaluationStepEnum.RECOMMONED)) {
				RecommonedEvaluationStepDialog dialog = new RecommonedEvaluationStepDialog(getShell(), tenderProjectEntity, evaluationStep);
				dialog.setCallBack(updateCallBack);
				dialog.open();
			}
		}
	}

	/**
	 * @Description: 验证是否已经进入评审环节
	 * @author guoyr
	 * @return
	 */
	private boolean isInEvaluationProgress() {
		boolean isInEvaluationProgress = tenderProjectService.isInProgress(tenderProjectEntity.getId(), null);
		if (isInEvaluationProgress) {
			MessageDialog.openInformation(getShell(), Messages.Dialog_warmTips, Messages.Tips_enteredEvaluation);
		}
		return isInEvaluationProgress;
	}

	/**
	 * @Description: 设置默认评标步骤
	 * @author guoyr
	 */
	private void configDefaultEvaluationStepAction() {
		if (setDefaultEvalStepBtn.getEnabled()) {
			boolean isInEvaluationProgress = tenderProjectService.isInProgress(tenderProjectEntity.getId(), null);
			if (isInEvaluationProgress) {
				MessageDialog.openInformation(getShell(), Messages.Dialog_warmTips, Messages.Tips_enteredEvaluation);
				return;
			}
			if (null != evaluationStepList && evaluationStepList.size() > 0) {
				if (!MessageDialog.openConfirm(getShell(), Messages.Dialog_warmTips, Messages.Tips_setStepTemplate, new String[]{Messages.Button_confirm, Messages.Button_cancel})) {
					return;
				}
			}
			CreateDefaultEvauationStepDialog dialog = new CreateDefaultEvauationStepDialog(getShell(), tenderProjectEntity);
			dialog.open();
			refreshEvaluationStepList(null);
		}
	}

	/**
	 * @Description: 清空评标步骤
	 * @author guoyr
	 */
	private void clearEvaluationStepAction() {
		if (isInEvaluationProgress()) {
			return;
		}
		if (!MessageDialog.openConfirm(getShell(), Messages.Dialog_warmTips, MessageFormat.format(Messages.Tips_deleteAllObject, Messages.Step_step), new String[]{Messages.Button_confirm, Messages.Button_cancel})) {
			return;
		}
		evaluationStepService.deleteAllEvaluationSteps(tenderProjectEntity.getId());
		evaluationGroupService.deleteByTenderId(tenderProjectEntity.getId());
		refreshEvaluationStepList(null);
		tenderProjectEntity.setEffectiveType(TenderProjectEnum.EFFECTIVE_YES);
		tenderProjectService.updateAssignProperty(tenderProjectEntity, new String[] {"id" ,"effectiveType" });
	}

	/**
	 * @Description: 显示或隐藏评标结果界面
	 * @author guoyr
	 */
	private void showOrHiddenViesAction() {
		if (null != sashForm.getMaximizedControl()) {
			show_evaluation_step_result.setText(Messages.Button_showInterfaceEffect);
			show_evaluation_step_result.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/arrow_up.png"));
			for (Control control : result_load_composite.getChildren()) {
				control.dispose();
			}
		} else {
			show_evaluation_step_result.setText(Messages.Button_hiddenInterfaceEffect);
			show_evaluation_step_result.setImage(ResourceManager.getPluginImage(IconsActivator.PLUGIN_ID, "icons/btn/blue/arrow_down.png"));
			if(null != curStep && !curStep.isDisposed() && null != curStep.getData("evaluationStep")){
				loadEvaluationResultComposite((EvaluationStep)curStep.getData("evaluationStep"), curStep);
			}
		}
	}

	protected void checkSubclass() {}

	public void onLoad(Action action) {
		for (Control control : result_load_composite.getChildren()) {
			control.dispose();
		}
	}

	public void loadComposite(Action action, Composite composite) {
		result_load_composite.layout();
	}

	public Composite getParentComposite() {
		return result_load_composite;
	}

}
