package com.steering.mes.zgmil.coup;

import java.sql.*;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import IceInternal.Ex;
import com.steering.comm.db.DBCommon;

import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;
import CoreFS.SC01.CoreConstantData;

import com.steering.comm.tools.StringTool;
import com.steering.common.*;
import com.steering.mes.signature.MeanValueCalculation;
import com.steering.mes.zgmil.entity.MilBaseAddressEntity;
import com.steering.mes.zgmil.entity.MilEtResultEntity;
import com.steering.mes.zgmil.entity.MilMtResultEntity;
import com.steering.mes.zgmil.entity.MilPlanEntity3;
import com.steering.mes.zgmil.entity.MilSlabScrapSeqEntity;
import com.steering.mes.zgmil.entity.MilTestingRackEntity;
import com.steering.mes.zgmil.entity.MilTestingResultDetailDesEntity;
import com.steering.mes.zgmil.entity.MilTestingResultDetailEntity;
import com.steering.mes.zgmil.entity.MilUlResulEntity;
import net.sf.json.JSONObject;

/**
 * ET(涡流探伤)实绩业务类
 * 
 * @author lr 2015/05/28
 * @version v1.0rghahes
 */
public class EddyCurrentTestingResult extends DBCommon {

	public CoreReturnObject getRollCard168(String jugeNo, String proPlanId,
			String gxPlanNo) {
		return this.getDataBySqlID("EddyCurrentTestingResult.getRollCard168",
				new Object[] { jugeNo, proPlanId, gxPlanNo });
	}

	/***
	 * 返线流通卡
	 * 
	 * @param jugeNo
	 * @return
	 */
	public CoreReturnObject getRollCard168BackLine(String jugeNo,
			String proPlanId, String gxPlanNo) {
		return this.getDataBySqlID(
				"EddyCurrentTestingResult.getRollCard168BackLine",
				new Object[] { jugeNo, proPlanId, gxPlanNo });
	}

	/**
	 * 查询ET探伤实绩
	 * 
	 */
	public CoreReturnObject GetETResult(String str, String proPlanId,
			String gxPlanNo) {
		return this.getDataBySqlID("FrmEddyCurrentTestingResult.ETResultQuery",
				new Object[] { str, proPlanId, gxPlanNo });
	}

	/**
	 * 查询MT探伤实绩
	 */
	public CoreReturnObject GetMTResult(String str, String proPlanId,
			String gxPlanNo) {
		return this.getDataBySqlID("FrmEddyCurrentTestingResult.GetMTResult",
				new Object[] { str, proPlanId, gxPlanNo });
	}

	/**
	 * 查询UT探伤实绩
	 */
	public CoreReturnObject GetUTResult(String str, String proPlanId,
			String gxPlanNo) {
		return this.getDataBySqlID("FrmEddyCurrentTestingResult.GetUTResult",
				new Object[] { str, proPlanId, gxPlanNo });
	}

	
	/**
	 * 取探伤位置
	 * @param connection
	 * @param letter
	 * @return
	 * @throws SQLException
	 */
	public static String getTestingPosition( Connection connection,String letter)
			throws SQLException {
		String testingPosition = "";
		String sql = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.getTestingPosition");
		PreparedStatement psta = connection.prepareStatement(sql);
		psta.setString(1, letter);
		ResultSet rs = psta.executeQuery();
		if (rs.next()) {
			testingPosition = rs.getString("TESTING_POSITION");
		}
		rs.close();
		psta.close();
		return testingPosition;
	}

	/**
	 * 添加实绩，更新主表Status
	 * 
	 * @return
	 * @throws SQLException 
	 */
	public CoreReturnObject AddETResult(
			com.steering.mes.zgmil.entity.MilEtResultEntity milet) throws SQLException {
		Connection connection = this.getDao(CoreConstantData.sysbeanstr)
		.getConnection();
		ArrayList<String> sqllist = new ArrayList<String>();
		milet.setTestingPosition(EddyCurrentTestingResult.getTestingPosition(connection,milet.getResultNo()));
		String sql = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdateMilPlanStatus");
		String sql1 = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.InsertETResult");
		sql1 = EntityTool.fillSqlByEntity(sql1, milet);
		sql = EntityTool.fillSqlByEntity(sql, milet);
		sqllist.add(sql);
		sqllist.add(sql1);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);
	}

	/**
	 * 添加实绩，更新主表Status
	 * @throws SQLException 
	 */
	public CoreReturnObject AddMTResult(
			com.steering.mes.zgmil.entity.MilMtResultEntity milmt) throws SQLException {
		Connection connection = this.getDao(CoreConstantData.sysbeanstr)
		.getConnection();
		ArrayList<String> sqllist = new ArrayList<String>();
		milmt.setTestingPosition(EddyCurrentTestingResult.getTestingPosition(connection,milmt.getResultNo()));
		String sql = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdateMilPlanStatus");
		String sql1 = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.InsertMTResult");
		sql1 = EntityTool.fillSqlByEntity(sql1, milmt);
		sql = EntityTool.fillSqlByEntity(sql, milmt);
		sqllist.add(sql);
		sqllist.add(sql1);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);
	}

	/**
	 * 添加实绩，更新主表Status
	 * 
	 * @param milul
	 * @return
	 */
	public CoreReturnObject AddUTResult(
			com.steering.mes.zgmil.entity.MilUlResulEntity milul) {
		ArrayList<String> sqllist = new ArrayList<String>();
		String sql = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdateMilPlanStatus");
		String sql1 = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.InsertUTResult");
		sql1 = EntityTool.fillSqlByEntity(sql1, milul);
		sql = EntityTool.fillSqlByEntity(sql, milul);
		sqllist.add(sql);
		sqllist.add(sql1);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);
	}

	/**
	 * 查询跟踪表记录
	 */
	public CoreReturnObject GetTestingRack(String str, String flagstatus,
			String proPlanId, String gxPlanNo) {
		return this.getDataBySqlID(
				"FrmEddyCurrentTestingResult.TestingRackQuery", new Object[] {
						str, proPlanId, gxPlanNo });
	}

	public CoreReturnObject CheckTestRack(String str, String flagstatus,
			String Colno) {
		return this.getDataBySqlID("FrmEddyCurrentTestingResult.CheckTestRack",
				new Object[] { str, Colno });
	}

	/**
	 * 计算前几道工序剔除半成品管子的支数 工序号(0-锯切前 1-锯切后 2-加热炉 3-穿孔 4-连轧 5-再加热炉 6-定径 7-分切前 8-分切后
	 * 9矫直 10-探伤 11-人工质检)
	 */
	public CoreReturnObject scrapMatCheck(String JUDGE_STOVE_NO,
			Integer PROCESS_NO, String proPlanId, String gxPlanNo) {
		CoreReturnObject cro = new CoreReturnObject();
		Connection conn = null;
		PROCESS_NO = PROCESS_NO - 1;
		int ScrapNumBefore = 0;// 总支数
		int DBNum = 0;// 倍尺数
		int SAWNUM = 0;// 分切数1
		int result = 0;// 半成品管结果
		String sql = "";
		String sqlWhere = "'";
		ResultSet rs_FEED = null;//
		ResultSet rs_SAW = null;
		ResultSet rs_SEQ = null;
		PreparedStatement psta_FEED = null;
		PreparedStatement psta_SAW = null;
		PreparedStatement psta_SEQ = null;

		try {
			conn = this.getDao("TgDao").getConnection();
			conn.setAutoCommit(false);
			sql = "select Sum(DB_NUM) FROM MIL_FEED_RACK WHERE STATUS = '3' AND JUDGE_STOVE_NO = '"
					+ JUDGE_STOVE_NO
					+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
					+ proPlanId
					+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
					+ gxPlanNo;
			sql += sqlWhere + ",'/')";
			psta_FEED = conn.prepareStatement(sql);
			rs_FEED = psta_FEED.executeQuery();
			while (rs_FEED.next()) {
				DBNum = rs_FEED.getInt(1);// 计算切前剔除的管坯的累计倍尺数
			}
			sql = "";
			sql = "select t.SAW_NUM from MIL_plan t where t.judge_stove_no='"
					+ JUDGE_STOVE_NO + "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
					+ proPlanId + "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
					+ gxPlanNo;
			sql += sqlWhere + ",'/')";
			psta_SAW = conn.prepareStatement(sql);
			rs_SAW = psta_SAW.executeQuery();
			while (rs_SAW.next()) {
				SAWNUM = rs_SAW.getInt(1);// 获取分切数
			}
			if (PROCESS_NO < 8)// 工序在分切前
			{

				sql = "";
				sql = "select Count(*) from  Mil_Slab_Scrap_Seq t where t.judge_stove_no='"
						+ JUDGE_STOVE_NO
						+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
						+ proPlanId
						+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
						+ gxPlanNo + "','/')";
				// sql += "' and t.process_no between '1' and '7";
				sql += " and t.process_no between '1' and '"
						+ String.valueOf(PROCESS_NO);
				sql += sqlWhere; // 查询
				psta_SEQ = conn.prepareStatement(sql);
				rs_SEQ = psta_SEQ.executeQuery();
				while (rs_SEQ.next()) {
					int temp = rs_SEQ.getInt(1);
					DBNum += temp;
				}
				result = DBNum;
			}
			if (PROCESS_NO > 7) {
				sql = "";
				sql = "select Count(*) from  Mil_Slab_Scrap_Seq t where t.judge_stove_no='"
						+ JUDGE_STOVE_NO
						+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
						+ proPlanId
						+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
						+ gxPlanNo + "','/')";
				sql += " and t.process_no between '1' and '7";
				sql += sqlWhere; // 查询
				psta_SEQ = conn.prepareStatement(sql);
				rs_SEQ = psta_SEQ.executeQuery();
				while (rs_SEQ.next()) {
					int temp = rs_SEQ.getInt(1);
					DBNum += temp;// 分切前所有倍尺数
				}
				sql = "";
				sql = "select Count(*) from  Mil_Slab_Scrap_Seq t where t.judge_stove_no= '"
						+ JUDGE_STOVE_NO
						+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
						+ proPlanId
						+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
						+ gxPlanNo + "','/')";
				sql += " and t.process_no between '8' and '"
						+ String.valueOf(PROCESS_NO);
				sql += sqlWhere; // 查询
				psta_SEQ = conn.prepareStatement(sql);
				rs_SEQ = psta_SEQ.executeQuery();
				while (rs_SEQ.next()) {
					int temp = rs_SEQ.getInt(1);
					result += temp;
				}
				result += DBNum * SAWNUM;
			}

			cro.setV_errMsg(String.valueOf(result).trim());
		} catch (SQLException sqle) {
			sqle.printStackTrace();
			try {
				conn.rollback();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		} finally {
			try {
				if (conn != null && !conn.isClosed()) {
					conn.close();
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		cro.setResult(0);
		return cro;
	}

	public CoreReturnObject scrapMatCheckAfterSaw(String JUDGE_STOVE_NO,
			Integer PROCESS_NO, String Colno, String proPlanId, String gxPlanNo) {
		// 8-分切后 9矫直 10-探伤
		String sql = "select Count(*) AS Countss from  Mil_Slab_Scrap_Seq t where t.judge_stove_no='"
				+ JUDGE_STOVE_NO
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
				+ proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
				+ gxPlanNo + "','/')";
		sql += " and t.process_no between '8' and '";
		sql += PROCESS_NO;
		sql += "' AND t.COL_NO= '" + Colno + "'";
		return this.getData(sql);
	}

	/**
	 * 如果剔除的是复探的子管
	 * 
	 * @param heatno
	 * @param flag
	 * @param Colno
	 * @return
	 */
	public CoreReturnObject scrapREINSPECTION(String heatno, String flag,
			String Colno) {
		String sql = "Update ";
		if (flag.equals("1")) {
			sql += "MIL_ET_RESULT t SET ";
		}
		if (flag.equals("2")) {
			sql += "MIL_MT_RESULT t SET ";
		}
		if (flag.equals("3")) {
			sql += "MIL_UL_RESUL t SET ";
		}
		if (Colno.equals("1")) {
			sql += " t.reinspection_qualified_num1= t.reinspection_qualified_num1-1,";
			sql += " t.reinspection_qualified_num=t.reinspection_qualified_num-1 ";
			sql += " where t.JUDGE_STOVE_NO='";
			sql += heatno;
			sql += "'";
		}
		if (Colno.equals("2")) {
			sql += " t.reinspection_qualified_num2= t.reinspection_qualified_num2-1,";
			sql += " t.reinspection_qualified_num=t.reinspection_qualified_num-1 ";
			sql += " where t.JUDGE_STOVE_NO='";
			sql += heatno;
			sql += "'";
		}
		if (Colno.equals("3")) {
			sql += " t.reinspection_qualified_num3= t.reinspection_qualified_num3-1,";
			sql += " t.reinspection_qualified_num=t.reinspection_qualified_num-1 ";
			sql += " where t.JUDGE_STOVE_NO='";
			sql += heatno;
			sql += "'";
		}
		return this.setData(sql);
	}

	/**
	 * 剔管操作，：1、插入MIL_SLAB_SCRAP_SEQ表，2、探伤跟踪记录表状态，3、修改加探伤实绩表剔除支数
	 */
	public CoreReturnObject scrapInspectionMat(
			com.steering.mes.zgmil.entity.MilSlabScrapSeqEntity ScrapSlab,
			String flag, String colno) {
		ArrayList<String> sqllist = new ArrayList<String>();
		// 新增剔除管号序列
		String sql = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.AddScrapSlabSeq");
		// 修改探伤跟踪表物料状态
		String sql1 = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdateFurStatue");

		// 修改探伤实绩表剔除支数
		String sql2 = "";
		if (flag.equals("1")) {
			if (colno.equals("1")) {
				sql2 = CoreXmlSqlParsersFactory
						.getSql("FrmEddyCurrentTestingResult.UpdateETFurScrapNum1");
			}
			if (colno.equals("2")) {
				sql2 = CoreXmlSqlParsersFactory
						.getSql("FrmEddyCurrentTestingResult.UpdateETFurScrapNum2");
			}
			if (colno.equals("3")) {
				sql2 = CoreXmlSqlParsersFactory
						.getSql("FrmEddyCurrentTestingResult.UpdateETFurScrapNum3");
			}
		}
		if (flag.equals("2")) {
			if (colno.equals("1")) {
				sql2 = CoreXmlSqlParsersFactory
						.getSql("FrmEddyCurrentTestingResult.UpdateMTFurScrapNum1");
			}
			if (colno.equals("2")) {
				sql2 = CoreXmlSqlParsersFactory
						.getSql("FrmEddyCurrentTestingResult.UpdateMTFurScrapNum2");
			}
		}
		if (flag.equals("3")) {
			if (colno.equals("1")) {
				sql2 = CoreXmlSqlParsersFactory
						.getSql("FrmEddyCurrentTestingResult.UpdateULFurScrapNum1");
			}
			if (colno.equals("2")) {
				sql2 = CoreXmlSqlParsersFactory
						.getSql("FrmEddyCurrentTestingResult.UpdateULFurScrapNum2");
			}
		}
		sql = EntityTool.fillSqlByEntity(sql, ScrapSlab);
		sql1 = EntityTool.fillSqlByEntity(sql1, ScrapSlab);
		sql2 = EntityTool.fillSqlByEntity(sql2, ScrapSlab);
		sqllist.add(sql);
		sqllist.add(sql1);
		sqllist.add(sql2);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);

	}

	/**
	 * 复探操作：1、更新复探跟踪表（插入复探原因，更新复探支数），2、探伤实绩表复探支数+1
	 */
	public CoreReturnObject ReInspection(
			com.steering.mes.zgmil.entity.MilTestingRackEntity testrack,
			String flag, String colno, String reflag) {
		ArrayList<String> arr = new ArrayList<String>();

		// 更新复探跟踪表（插入状态，复探原因，更新复探支数）
		String sql = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UPdateTestRAckStatus");
		// 探伤实绩表复探支数+1
		String sql1 = "";
		String sql2 = "";
		if (flag.equals("1")) {
			if (colno.equals("1")) {
				sql1 = CoreXmlSqlParsersFactory
						.getSql("FrmEddyCurrentTestingResult.UPdateETResultREINSPECTION_NUM1");
				if (reflag.equals("1")) {
					sql2 += "UPDATE MIL_ET_RESULT t SET t.reinspection_qualified_num1=t.reinspection_qualified_num1+1,";
					sql2 += "t.reinspection_qualified_num=t.reinspection_qualified_num+1 ";
					sql2 += " WHERE t.judge_stove_no='";
					sql2 += testrack.getJudgeStoveNo();
					sql2 += "'";
				}
			}
			if (colno.equals("2")) {
				sql1 = CoreXmlSqlParsersFactory
						.getSql("FrmEddyCurrentTestingResult.UPdateETResultREINSPECTION_NUM2");
				if (reflag.equals("1")) {
					sql2 += "UPDATE MIL_ET_RESULT t SET t.reinspection_qualified_num2=t.reinspection_qualified_num2+1,";
					sql2 += "t.reinspection_qualified_num=t.reinspection_qualified_num+1 ";
					sql2 += " WHERE t.judge_stove_no='";
					sql2 += testrack.getJudgeStoveNo();
					sql2 += "'";
				}
			}
			if (colno.equals("3")) {
				sql1 = CoreXmlSqlParsersFactory
						.getSql("FrmEddyCurrentTestingResult.UPdateETResultREINSPECTION_NUM3");
				if (reflag.equals("1")) {
					sql2 += "UPDATE MIL_ET_RESULT t SET t.reinspection_qualified_num3=t.reinspection_qualified_num3+1,";
					sql2 += "t.reinspection_qualified_num=t.reinspection_qualified_num+1 ";
					sql2 += " WHERE t.judge_stove_no='";
					sql2 += testrack.getJudgeStoveNo();
					sql2 += "'";
				}
			}
		}
		if (flag.equals("2")) {
			if (colno.equals("1")) {
				sql1 = CoreXmlSqlParsersFactory
						.getSql("FrmEddyCurrentTestingResult.UPdateMTResultREINSPECTION_NUM1");
				if (reflag.equals("1")) {
					sql2 += "UPDATE MIL_MT_RESULT t SET t.reinspection_qualified_num1=t.reinspection_qualified_num1+1,";
					sql2 += "t.reinspection_qualified_num=t.reinspection_qualified_num+1 ";
					sql2 += " WHERE t.judge_stove_no='";
					sql2 += testrack.getJudgeStoveNo();
					sql2 += "'";
				}
			}
			if (colno.equals("2")) {
				sql1 = CoreXmlSqlParsersFactory
						.getSql("FrmEddyCurrentTestingResult.UPdateMTResultREINSPECTION_NUM2");
				if (reflag.equals("1")) {
					sql2 += "UPDATE MIL_MT_RESULT t SET t.reinspection_qualified_num2=t.reinspection_qualified_num2+1,";
					sql2 += "t.reinspection_qualified_num=t.reinspection_qualified_num+1 ";
					sql2 += " WHERE t.judge_stove_no='";
					sql2 += testrack.getJudgeStoveNo();
					sql2 += "'";
				}
			}
		}
		if (flag.equals("3")) {
			if (colno.equals("1")) {
				sql1 = CoreXmlSqlParsersFactory
						.getSql("FrmEddyCurrentTestingResult.UPdateUTResultREINSPECTION_NUM1");
				if (reflag.equals("1")) {
					sql2 += "UPDATE Mil_Ul_Resul t SET t.reinspection_qualified_num1=t.reinspection_qualified_num1+1,";
					sql2 += "t.reinspection_qualified_num=t.reinspection_qualified_num+1 ";
					sql2 += " WHERE t.judge_stove_no='";
					sql2 += testrack.getJudgeStoveNo();
					sql2 += "'";
				}
			}
			if (colno.equals("2")) {
				sql1 = CoreXmlSqlParsersFactory
						.getSql("FrmEddyCurrentTestingResult.UPdateUTResultREINSPECTION_NUM2");
				if (reflag.equals("1")) {
					sql2 += "UPDATE Mil_Ul_Resul t SET t.reinspection_qualified_num2=t.reinspection_qualified_num2+1,";
					sql2 += "t.reinspection_qualified_num=t.reinspection_qualified_num+1 ";
					sql2 += " WHERE t.judge_stove_no='";
					sql2 += testrack.getJudgeStoveNo();
					sql2 += "'";
				}
			}
		}
		sql = EntityTool.fillSqlByEntity(sql, testrack);
		sql1 = EntityTool.fillSqlByEntity(sql1, testrack);
		arr.add(sql);
		if (reflag.equals("1")) {
			arr.add(sql1);
			arr.add(sql2);
		}

		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(arr);
	}

	public CoreReturnObject ReInspectionBACK(
			com.steering.mes.zgmil.entity.MilTestingRackEntity testrack,
			String flag, String colno) {
		ArrayList<String> sqllist = new ArrayList<String>();
		String sql = "";
		String sql1 = "";
		String sql2 = "";
		if (testrack.getRetestNum().equals("1")) {
			sql = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.UPdateTestRAckStatusBACK");
		} else {
			sql = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.UPdateTestRAckNumBACK");
		}

		if (flag.equals("1")) {
			if (colno.equals("1")) {
				if (testrack.getRetestNum().equals("1")) {
					sql1 = CoreXmlSqlParsersFactory
							.getSql("FrmEddyCurrentTestingResult.UPdateETResultREINSPECTION_NUM1BACK");
					sql2 += "UPDATE MIL_ET_RESULT t SET t.reinspection_qualified_num1=t.reinspection_qualified_num1-1,";
					sql2 += "t.reinspection_qualified_num=t.reinspection_qualified_num-1 ";
					sql2 += " WHERE t.judge_stove_no='";
					sql2 += testrack.getJudgeStoveNo();
					sql2 += "'";
				}
			}
			if (colno.equals("2")) {
				if (testrack.getRetestNum().equals("1")) {
					sql1 = CoreXmlSqlParsersFactory
							.getSql("FrmEddyCurrentTestingResult.UPdateETResultREINSPECTION_NUM2BACK");
					sql2 += "UPDATE MIL_ET_RESULT t SET t.reinspection_qualified_num2=t.reinspection_qualified_num2-1,";
					sql2 += "t.reinspection_qualified_num=t.reinspection_qualified_num-1 ";
					sql2 += " WHERE t.judge_stove_no='";
					sql2 += testrack.getJudgeStoveNo();
					sql2 += "'";
				}
			}
			if (colno.equals("3")) {
				if (testrack.getRetestNum().equals("1")) {
					sql1 = CoreXmlSqlParsersFactory
							.getSql("FrmEddyCurrentTestingResult.UPdateETResultREINSPECTION_NUM3BACK");
					sql2 += "UPDATE MIL_ET_RESULT t SET t.reinspection_qualified_num3=t.reinspection_qualified_num3-1,";
					sql2 += "t.reinspection_qualified_num=t.reinspection_qualified_num-1 ";
					sql2 += " WHERE t.judge_stove_no='";
					sql2 += testrack.getJudgeStoveNo();
					sql2 += "'";
				}
			}
		}

		if (flag.equals("2")) {
			if (colno.equals("1")) {
				if (testrack.getRetestNum().equals("1")) {
					sql1 = CoreXmlSqlParsersFactory
							.getSql("FrmEddyCurrentTestingResult.UPdateMTResultREINSPECTION_NUM1BACK");
					sql2 += "UPDATE MIL_MT_RESULT t SET t.reinspection_qualified_num1=t.reinspection_qualified_num1-1,";
					sql2 += "t.reinspection_qualified_num=t.reinspection_qualified_num-1 ";
					sql2 += " WHERE t.judge_stove_no='";
					sql2 += testrack.getJudgeStoveNo();
					sql2 += "'";
				}
			}
			if (colno.equals("2")) {
				if (testrack.getRetestNum().equals("1")) {
					sql1 = CoreXmlSqlParsersFactory
							.getSql("FrmEddyCurrentTestingResult.UPdateMTResultREINSPECTION_NUM1BACK");
					sql2 += "UPDATE MIL_MT_RESULT t SET t.reinspection_qualified_num2=t.reinspection_qualified_num2-1,";
					sql2 += "t.reinspection_qualified_num=t.reinspection_qualified_num-1 ";
					sql2 += " WHERE t.judge_stove_no='";
					sql2 += testrack.getJudgeStoveNo();
					sql2 += "'";
				}
			}
		}
		if (flag.equals("3")) {
			if (colno.equals("1")) {
				if (testrack.getRetestNum().equals("1")) {
					sql1 = CoreXmlSqlParsersFactory
							.getSql("FrmEddyCurrentTestingResult.UPdateUTResultREINSPECTION_NUM1BACK");
					sql2 += "UPDATE Mil_Ul_Resul t SET t.reinspection_qualified_num1=t.reinspection_qualified_num1-1,";
					sql2 += "t.reinspection_qualified_num=t.reinspection_qualified_num-1 ";
					sql2 += " WHERE t.judge_stove_no='";
					sql2 += testrack.getJudgeStoveNo();
					sql2 += "'";
				}
			}
			if (colno.equals("2")) {
				if (testrack.getRetestNum().equals("1")) {
					sql1 = CoreXmlSqlParsersFactory
							.getSql("FrmEddyCurrentTestingResult.UPdateUTResultREINSPECTION_NUM2BACK");
					sql2 += "UPDATE Mil_Ul_Resul t SET t.reinspection_qualified_num2=t.reinspection_qualified_num2-1,";
					sql2 += "t.reinspection_qualified_num=t.reinspection_qualified_num-1 ";
					sql2 += " WHERE t.judge_stove_no='";
					sql2 += testrack.getJudgeStoveNo();
					sql2 += "'";
				}
			}
		}
		sql = EntityTool.fillSqlByEntity(sql, testrack);
		sqllist.add(sql);
		if (testrack.getRetestNum().equals("1")) {
			sql1 = EntityTool.fillSqlByEntity(sql1, testrack);
			sqllist.add(sql1);
			sqllist.add(sql2);
		}

		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);

	}

	/**
	 * 可疑品赋值
	 * 
	 * @param heatno
	 * @param flag
	 * @param colno
	 * @return
	 */
	public CoreReturnObject Suspect(String heatno, String flag, String colno,
			String SEQ, Integer AlarmReason) {
		ArrayList<String> arr = new ArrayList<String>();
		String sql1 = "UPDATE MIL_TESTING_RACK t SET t.SUSPECT_FLAG =1  , ALARM_REASON="
				+ AlarmReason + " WHERE　t.JUDGE_STOVE_NO='";
		sql1 += heatno;
		sql1 += "' AND t.seq=";
		sql1 += SEQ;

		String sql2 = "";
		if (flag.equals("1")) {
			if (colno.equals("1")) {
				sql2 += "UPDATE MIL_ET_RESULT t SET t.suspect_product_num1=t.suspect_product_num1 + 1, ";
				sql2 += " t.suspect_product_num=t.suspect_product_num+1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
			if (colno.equals("2")) {
				sql2 += "UPDATE MIL_ET_RESULT t SET t.suspect_product_num2=t.suspect_product_num2 + 1, ";
				sql2 += " t.suspect_product_num=t.suspect_product_num+1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
			if (colno.equals("3")) {
				sql2 += "UPDATE MIL_ET_RESULT t SET t.suspect_product_num3=t.suspect_product_num3 + 1, ";
				sql2 += " t.suspect_product_num=t.suspect_product_num+1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}

		}
		if (flag.equals("2")) {
			if (colno.equals("1")) {
				sql2 += "UPDATE MIL_MT_RESULT t SET t.suspect_product_num1=t.suspect_product_num1 + 1, ";
				sql2 += " t.alarm_num=t.alarm_num+1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
			if (colno.equals("2")) {
				sql2 += "UPDATE MIL_MT_RESULT t SET t.suspect_product_num2=t.suspect_product_num2 + 1, ";
				sql2 += " t.alarm_num=t.alarm_num+1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
		}
		if (flag.equals("3")) {
			if (colno.equals("1")) {
				sql2 += "UPDATE MIL_UL_RESUL t SET t.suspect_product_num1=t.suspect_product_num1 + 1, ";
				sql2 += " t.alarm_num=t.alarm_num+1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
			if (colno.equals("2")) {
				sql2 += "UPDATE MIL_UL_RESUL t SET t.suspect_product_num2=t.suspect_product_num2 + 1, ";
				sql2 += " t.alarm_num=t.alarm_num+1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
		}
		arr.add(sql1);
		arr.add(sql2);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(arr);
	}

	/**
	 * 可疑回退
	 * 
	 * @param heatno
	 * @param flag
	 * @param colno
	 * @param SEQ
	 * @return
	 */
	public CoreReturnObject SuspectBack(String heatno, String flag,
			String colno, String SEQ) {
		ArrayList<String> arr = new ArrayList<String>();
		String sql1 = "UPDATE MIL_TESTING_RACK t SET t.SUSPECT_FLAG =0 , ALARM_REASON='' WHERE　t.JUDGE_STOVE_NO='";
		sql1 += heatno;
		sql1 += "' AND t.seq=";
		sql1 += SEQ;

		String sql2 = "";
		if (flag.equals("1")) {
			if (colno.equals("1")) {
				sql2 += "UPDATE MIL_ET_RESULT t SET t.suspect_product_num1=t.suspect_product_num1 - 1, ";
				sql2 += " t.suspect_product_num=t.suspect_product_num-1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
			if (colno.equals("2")) {
				sql2 += "UPDATE MIL_ET_RESULT t SET t.suspect_product_num2=t.suspect_product_num2 - 1, ";
				sql2 += " t.suspect_product_num=t.suspect_product_num-1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
			if (colno.equals("3")) {
				sql2 += "UPDATE MIL_ET_RESULT t SET t.suspect_product_num3=t.suspect_product_num3 - 1, ";
				sql2 += " t.suspect_product_num=t.suspect_product_num-1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}

		}
		if (flag.equals("2")) {
			if (colno.equals("1")) {
				sql2 += "UPDATE MIL_MT_RESULT t SET t.suspect_product_num1=t.suspect_product_num1 - 1, ";
				sql2 += " t.alarm_num=t.alarm_num-1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
			if (colno.equals("2")) {
				sql2 += "UPDATE MIL_MT_RESULT t SET t.suspect_product_num2=t.suspect_product_num2 - 1, ";
				sql2 += " t.alarm_num=t.alarm_num-1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
		}
		if (flag.equals("3")) {
			if (colno.equals("1")) {
				sql2 += "UPDATE MIL_UL_RESUL t SET t.suspect_product_num1=t.suspect_product_num1 - 1, ";
				sql2 += " t.alarm_num=t.alarm_num-1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
			if (colno.equals("2")) {
				sql2 += "UPDATE MIL_UL_RESUL t SET t.suspect_product_num2=t.suspect_product_num2 - 1, ";
				sql2 += " t.alarm_num=t.alarm_num-1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
		}
		arr.add(sql1);
		arr.add(sql2);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(arr);
	}

	public CoreReturnObject Recut(String heatno, String flag, String colno,
			String SEQ, String recutlength) {
		ArrayList<String> sqllist = new ArrayList<String>();
		String sql1 = "";
		String sql2 = "";

		sql1 = "UPDATE MIL_TESTING_RACK T SET T.RECUT_FLAG='1' ,T.RECUT_LENGTH=";
		sql1 += recutlength;
		sql1 += " WHERE T.JUDGE_STOVE_NO='";
		sql1 += heatno;
		sql1 += "' AND T.SEQ=";
		sql1 += SEQ;

		if (flag.equals("1")) {
			if (colno.equals("1")) {
				sql2 += "UPDATE MIL_ET_RESULT t SET t.RECUT_NUM1=t.RECUT_NUM1 + 1, ";
				sql2 += " t.RECUT_NUM=t.RECUT_NUM + 1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
			if (colno.equals("2")) {
				sql2 += "UPDATE MIL_ET_RESULT t SET t.RECUT_NUM2=t.RECUT_NUM2 + 1, ";
				sql2 += " t.RECUT_NUM=t.RECUT_NUM + 1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
			if (colno.equals("3")) {
				sql2 += "UPDATE MIL_ET_RESULT t SET t.RECUT_NUM3=t.RECUT_NUM3 + 1, ";
				sql2 += " t.RECUT_NUM=t.RECUT_NUM +1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
		}
		if (flag.equals("2")) {
			if (colno.equals("1")) {
				sql2 += "UPDATE MIL_MT_RESULT t SET t.RECUT_NUM1=t.RECUT_NUM1 + 1, ";
				sql2 += " t.RECUT_NUM=t.RECUT_NUM +1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
			if (colno.equals("2")) {
				sql2 += "UPDATE MIL_MT_RESULT t SET t.RECUT_NUM2=t.RECUT_NUM2 + 1, ";
				sql2 += " t.RECUT_NUM=t.RECUT_NUM + 1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
		}
		if (flag.equals("3")) {
			if (colno.equals("1")) {
				sql2 += "UPDATE MIL_UL_RESUL t SET t.RECUT_NUM1=t.RECUT_NUM1 + 1, ";
				sql2 += " t.RECUT_NUM=t.RECUT_NUM + 1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
			if (colno.equals("2")) {
				sql2 += "UPDATE MIL_UL_RESUL t SET t.RECUT_NUM2=t.RECUT_NUM2 + 1, ";
				sql2 += " t.RECUT_NUM=t.RECUT_NUM + 1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
		}
		sqllist.add(sql1);
		sqllist.add(sql2);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);
	}

	public CoreReturnObject RecutBack(String heatno, String flag, String colno,
			String SEQ) {
		ArrayList<String> sqllist = new ArrayList<String>();
		String sql1 = "";
		String sql2 = "";

		sql1 = "UPDATE MIL_TESTING_RACK T SET T.RECUT_FLAG='0' ,T.RECUT_LENGTH= ''";
		sql1 += " WHERE T.JUDGE_STOVE_NO='";
		sql1 += heatno;
		sql1 += "' AND T.SEQ=";
		sql1 += SEQ;

		if (flag.equals("1")) {
			if (colno.equals("1")) {
				sql2 += "UPDATE MIL_ET_RESULT t SET t.RECUT_NUM1=t.RECUT_NUM1 - 1, ";
				sql2 += " t.RECUT_NUM=t.RECUT_NUM - 1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
			if (colno.equals("2")) {
				sql2 += "UPDATE MIL_ET_RESULT t SET t.RECUT_NUM2=t.RECUT_NUM2 - 1, ";
				sql2 += " t.RECUT_NUM=t.RECUT_NUM - 1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
			if (colno.equals("3")) {
				sql2 += "UPDATE MIL_ET_RESULT t SET t.RECUT_NUM3=t.RECUT_NUM3 - 1, ";
				sql2 += " t.RECUT_NUM=t.RECUT_NUM -1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
		}
		if (flag.equals("2")) {
			if (colno.equals("1")) {
				sql2 += "UPDATE MIL_MT_RESULT t SET t.RECUT_NUM1=t.RECUT_NUM1 - 1, ";
				sql2 += " t.RECUT_NUM=t.RECUT_NUM -1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
			if (colno.equals("2")) {
				sql2 += "UPDATE MIL_MT_RESULT t SET t.RECUT_NUM2=t.RECUT_NUM2 - 1, ";
				sql2 += " t.RECUT_NUM=t.RECUT_NUM - 1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
		}
		if (flag.equals("3")) {
			if (colno.equals("1")) {
				sql2 += "UPDATE MIL_UL_RESUL t SET t.RECUT_NUM1=t.RECUT_NUM1 - 1, ";
				sql2 += " t.RECUT_NUM=t.RECUT_NUM - 1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
			if (colno.equals("2")) {
				sql2 += "UPDATE MIL_UL_RESUL t SET t.RECUT_NUM2=t.RECUT_NUM2 - 1, ";
				sql2 += " t.RECUT_NUM=t.RECUT_NUM - 1 ";
				sql2 += " WHERE　t.JUDGE_STOVE_NO='";
				sql2 += heatno;
				sql2 += "'";
			}
		}
		sqllist.add(sql1);
		sqllist.add(sql2);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);

	}

	/**
	 * 插入ET探伤实绩表
	 * 
	 * @param milet
	 * @return
	 */
	public CoreReturnObject UpdateETResult(
			com.steering.mes.zgmil.entity.MilEtResultEntity milet,
			String Colno, String saveflag) {
		ArrayList<String> arr = new ArrayList<String>();

		String sql = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdatETResult");
		String sqlnum = "";
		if (Colno.equals("1")) {
			sqlnum = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.UpdatETResultnum1");
		}
		if (Colno.equals("2")) {
			sqlnum = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.UpdatETResultnum2");
		}
		if (Colno.equals("3")) {
			sqlnum = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.UpdatETResultnum3");
		}
		sql = EntityTool.fillSqlByEntity(sql, milet);
		arr.add(sql);
		if (saveflag.equals("0")) {
			sqlnum = EntityTool.fillSqlByEntity(sqlnum, milet);
			arr.add(sqlnum);
		}
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(arr);
	}

	/**
	 * 插入MT探伤实绩表
	 */
	public CoreReturnObject UpdateMTResult(
			com.steering.mes.zgmil.entity.MilMtResultEntity milmt,
			String colno, String saveflag) {
		ArrayList<String> arr = new ArrayList<String>();

		String sql = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdatMTResult");
		String sqlnum = "";
		if (colno.equals("1")) {
			sqlnum = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.UpdatMTResultnum1");
		}
		if (colno.equals("2")) {
			sqlnum = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.UpdatMTResultnum2");
		}
		sql = EntityTool.fillSqlByEntity(sql, milmt);
		arr.add(sql);
		if (saveflag.equals("0")) {
			sqlnum = EntityTool.fillSqlByEntity(sqlnum, milmt);
			arr.add(sqlnum);
		}
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(arr);
	}

	/**
	 * 插入UT探伤实绩表
	 * 
	 * @param milul
	 * @return
	 */
	public CoreReturnObject UpdateUTResult(
			com.steering.mes.zgmil.entity.MilUlResulEntity milul, String colno,
			String saveflag) {
		ArrayList<String> arr = new ArrayList<String>();

		String sql = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdatUTResult");
		String sqlnum = "";
		if (colno.equals("1")) {
			sqlnum = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.UpdatUTResultnum1");
		}
		if (colno.equals("2")) {
			sqlnum = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.UpdatUTResultnum2");
		}
		sql = EntityTool.fillSqlByEntity(sql, milul);
		arr.add(sql);
		if (saveflag.equals("0")) {
			sqlnum = EntityTool.fillSqlByEntity(sqlnum, milul);
			arr.add(sqlnum);
		}
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(arr);
	}

	/**
	 * 1.查询矫直实绩表
	 * 
	 */
	public CoreReturnObject GetMIL_STRAIGHTENING_RESULT(String JudgeStoveNo,
			String proPlanId, String gxPlanNo) {
		return this.getDataBySqlID(
				"FrmEddyCurrentTestingResult.GetMIL_STRAIGHTENING_RESULT",
				new Object[] { JudgeStoveNo, proPlanId, gxPlanNo });
	}

	/**
	 * 2、更新ET实绩表（包括结炉时间） 3.更新主表NODE_STATUS
	 */
	public CoreReturnObject UpdateETResultNode(
			com.steering.mes.zgmil.entity.MilEtResultEntity milet, String Colno) {
		ArrayList<String> arr = new ArrayList<String>();

		// String sql = CoreXmlSqlParsersFactory
		// .getSql("FrmEddyCurrentTestingResult.UpdateETResultNODE");
		// String sq2 = CoreXmlSqlParsersFactory
		// .getSql("FrmEddyCurrentTestingResult.UpdateMilPlanNode");
		String sql = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdatETResult");
		String sqlnum = "";
		if (Colno.equals("1")) {
			sqlnum = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.UpdatETResultnum1");
		}
		if (Colno.equals("2")) {
			sqlnum = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.UpdatETResultnum2");
		}
		if (Colno.equals("3")) {
			sqlnum = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.UpdatETResultnum3");
		}
		String sql2 = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdateRackShift");
		String sql3 = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdateETResultShift");
		sql3 = EntityTool.fillSqlByEntity(sql3, milet);
		sql2 = EntityTool.fillSqlByEntity(sql2, milet);
		sql = EntityTool.fillSqlByEntity(sql, milet);
		sqlnum = EntityTool.fillSqlByEntity(sqlnum, milet);
		arr.add(sql);
		arr.add(sqlnum);
		arr.add(sql2);
		arr.add(sql3);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(arr);

	}

	/**
	 * 更新MT实绩，更新主表结炉状态
	 */
	public CoreReturnObject UpdateMTResultNode(
			com.steering.mes.zgmil.entity.MilMtResultEntity milmt, String colno) {
		ArrayList<String> arr = new ArrayList<String>();

		// String sql = CoreXmlSqlParsersFactory
		// .getSql("FrmEddyCurrentTestingResult.UpdatMTResult");// 更新MT实绩
		// String sql1 = CoreXmlSqlParsersFactory
		// .getSql("FrmEddyCurrentTestingResult.UpdateMTResultNODE");//
		// 更新结炉时间,结炉状态
		// String sq2 = CoreXmlSqlParsersFactory
		// .getSql("FrmEddyCurrentTestingResult.UpdateMilPlanNode");
		// sql = EntityTool.fillSqlByEntity(sql, milmt);
		// sql1 = EntityTool.fillSqlByEntity(sql1, milmt);
		// sq2 = EntityTool.fillSqlByEntity(sq2, milmt);
		// arr.add(sql);
		// arr.add(sq2);
		// arr.add(sql1);
		String sql = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdatMTResult");
		String sqlnum = "";
		if (colno.equals("1")) {
			sqlnum = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.UpdatMTResultnum1");
		}
		if (colno.equals("2")) {
			sqlnum = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.UpdatMTResultnum2");
		}
		String sql2 = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdateRackShift");
		String sql3 = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdateMTResultShift");
		sql3 = EntityTool.fillSqlByEntity(sql3, milmt);
		sql2 = EntityTool.fillSqlByEntity(sql2, milmt);
		sql = EntityTool.fillSqlByEntity(sql, milmt);
		sqlnum = EntityTool.fillSqlByEntity(sqlnum, milmt);
		arr.add(sql);
		arr.add(sqlnum);
		arr.add(sql2);
		arr.add(sql3);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(arr);
	}

	/**
	 * 更新UT探伤实绩，更新主表状态
	 */
	public CoreReturnObject UpdateUTResultNode(
			com.steering.mes.zgmil.entity.MilUlResulEntity milul, String colno) {
		ArrayList<String> arr = new ArrayList<String>();

		// String sql = CoreXmlSqlParsersFactory
		// .getSql("FrmEddyCurrentTestingResult.UpdatUTResult");// 更新UT实绩
		// String sql1 = CoreXmlSqlParsersFactory
		// .getSql("FrmEddyCurrentTestingResult.UpdateUTResultNODE");//
		// 更新结炉时间,结炉状态
		// String sq2 = CoreXmlSqlParsersFactory
		// .getSql("FrmEddyCurrentTestingResult.UpdateMilPlanNode");
		// sql = EntityTool.fillSqlByEntity(sql, milul);
		// sql1 = EntityTool.fillSqlByEntity(sql1, milul);
		// sq2 = EntityTool.fillSqlByEntity(sq2, milul);
		// arr.add(sql);
		// arr.add(sq2);
		// arr.add(sql1);
		String sql = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdatUTResult");
		String sqlnum = "";
		if (colno.equals("1")) {
			sqlnum = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.UpdatUTResultnum1");
		}
		if (colno.equals("2")) {
			sqlnum = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.UpdatUTResultnum2");
		}
		String sql2 = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdateRackShift");
		String sql3 = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdateUTResultShift");
		sql3 = EntityTool.fillSqlByEntity(sql3, milul);
		sql = EntityTool.fillSqlByEntity(sql, milul);
		sqlnum = EntityTool.fillSqlByEntity(sqlnum, milul);
		sql2 = EntityTool.fillSqlByEntity(sql2, milul);
		arr.add(sql);
		arr.add(sqlnum);
		arr.add(sql2);
		arr.add(sql3);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(arr);

	}

	/**
	 * 操作台结炉后自动判断并整炉结炉
	 * 
	 * @param heatno
	 * @param flag
	 * @return
	 */
	public CoreReturnObject UpdateToTalNode(String heatno, String flag) {
		ArrayList<String> arr = new ArrayList<String>();
		String sql1 = "";
		if (flag.equals("1")) {
			sql1 = "UPDATE MIL_ET_RESULT t SET ";
		}
		if (flag.equals("2")) {
			sql1 = "UPDATE MIL_MT_RESULT t SET ";
		}
		if (flag.equals("3")) {
			sql1 = "UPDATE MIL_UL_RESUL t SET ";
		}
		sql1 += " t.NODE_FUR_FLAG='1', t.end_time=SYSDATE WHERE t.JUDGE_STOVE_NO='";
		sql1 += heatno;
		sql1 += "'";

		String sql2 = "update MIL_PLAN t set t.node_status='90'";
		sql2 += "WHERE JUDGE_STOVE_NO='";
		sql2 += heatno;
		sql2 += "'";

		arr.add(sql1);
		arr.add(sql2);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(arr);
	}

	public CoreReturnObject GetDETECTION_NUM(String heatno, String flag) {
		String sql = "";
		sql = "select count(judge_stove_no) as counts from MIL_TESTING_RACK t where t.judge_stove_no='";
		sql += heatno;
		sql += "' AND t.COL_NO='";
		sql += flag;
		sql += "'";
		return this.getData(sql);
	}

	/**
	 * 查询结炉实绩
	 * 
	 * @param PliceCode
	 * @param Shift
	 * @param Group
	 * @param StartTime
	 * @param EndTime
	 * @return
	 */
	public CoreReturnObject GetETResultNodeQuery(String PliceCode,
			String Shift, String Group, String StartTime, String EndTime) {
		return this.getDataBySqlID(
				"FrmEddyCurrentTestingResult.GetETResultNodeQuery",
				new Object[] { PliceCode, Shift, Group, StartTime, EndTime });
	}

	/**
	 * 查询结炉实绩
	 * 
	 * @param PliceCode
	 * @param Shift
	 * @param Group
	 * @param StartTime
	 * @param EndTime
	 * @return
	 */
	public CoreReturnObject GetMTResultNodeQuery(String PliceCode,
			String Shift, String Group, String StartTime, String EndTime) {
		return this.getDataBySqlID(
				"FrmEddyCurrentTestingResult.GetMTResultNodeQuery",
				new Object[] { PliceCode, Shift, Group, StartTime, EndTime });
	}

	/**
	 * 查询结炉实绩
	 * 
	 * @param PliceCode
	 * @param Shift
	 * @param Group
	 * @param StartTime
	 * @param EndTime
	 * @return
	 */
	public CoreReturnObject GetUTResultNodeQuery(String PliceCode,
			String Shift, String Group, String StartTime, String EndTime) {
		return this.getDataBySqlID(
				"FrmEddyCurrentTestingResult.GetUTResultNodeQuery",
				new Object[] { PliceCode, Shift, Group, StartTime, EndTime });
	}

	public CoreReturnObject GetRackCounts(String heatno) {

		String sql = "select count(*) AS COUNTSS from MIL_TESTING_RACK t where t.judge_stove_no ='";
		sql += heatno;
		sql += "'";
		return this.getData(sql);
	}

	public CoreReturnObject GetTSNodeFlagColno(String HeatNo, Integer flag,
			Integer Colno) {
		String[] TableNameList = new String[] { "MIL_ET_RESULT",
				"MIL_MT_RESULT", "MIL_UL_RESUL" };
		String[] stringNameList = new String[] { "NODE_FUR_FLAG1",
				"NODE_FUR_FLAG2", "NODE_FUR_FLAG3" };
		String tablename = TableNameList[flag - 1];
		String stringname = stringNameList[Colno - 1];

		String sql = "SELECT T." + stringname + " AS NODEFLAG  FROM "
				+ tablename + " T WHERE T.JUDGE_STOVE_NO='" + HeatNo + "'";
		return this.getData(sql);

	}

	/**
	 * 跟踪记录表的备注保存
	 * 
	 * @param process
	 *            0-开始分切 1-开始矫直 2-开始探伤
	 * @param Seq
	 * @param hratno
	 * @param ramark
	 * @return
	 */
	public CoreReturnObject SaveRackRemark(Integer process, Integer Seq,
			String hratno, String ramark) {
		ArrayList sqllist = new ArrayList();
		String[] TableNameList = new String[] { "MIL_SAW_RACK",
				"MIL_STRAIGH_RACK", "MIL_TESTING_RACK" };
		String TableName = TableNameList[process];
		String sql = "";
		String sql1 = "";

		sql = "UPDATE " + TableName + " t SET  t.Remark=";
		sql += ramark;
		sql += " WHERE t.judge_stove_no='";
		sql += hratno;
		sql += "' AND t.seq=";
		sql += Seq;

		sqllist.add(sql);

		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);
	}

	public CoreReturnObject GetDBWeightfromMILPlan(String heatno) {
		String sql = "select t.db_height, t.SAW_NUM from MIL_PLAN t WHERE t.judge_stove_no='";
		sql += heatno;
		sql += "'";
		return this.getData(sql);
	}

	public CoreReturnObject GetBURNNING_RATEfromFur(String heatno) {
		String sql = "select t.burnning_rate from Mil_Fur_Result t WHERE t.judge_stove_no='";
		sql += heatno;
		sql += "'";
		return this.getData(sql);
	}

	public CoreReturnObject GetBURNNING_RATEfromReFur(String heatno) {
		String sql = "select t.BURNINGRATE from MIL_REFUR_RESULT t WHERE t.judge_stove_no='";
		sql += heatno;
		sql += "'";
		return this.getData(sql);
	}

	public CoreReturnObject GetLengthPercent(String heatno) {
		String sql = "select NVl(t.cut_head_length,0)cut_head_length,NVL(t.cut_trail_length,0)cut_trail_length,NVL(t.order_length,0)order_length,NVL(t.saw_num,0)saw_num from MIL_SAW_RESULT t WHERE t.judge_stove_no='";
		sql += heatno;
		sql += "'";
		return this.getData(sql);
	}

	public CoreReturnObject GetRackChangeFlag(String JudgeStoveNo,
			String ResultNo, String Seq, Integer process, String colno,
			String Shift, String Group, String proPlanId, String gxPlanNo) {
		String[] TableNameList = new String[] { "MIL_SAW_RACK",
				"MIL_STRAIGH_RACK", "MIL_TESTING_RACK" };
		String tablename = TableNameList[process];

		String sql = "SELECT MIN(SEQ) AS SEQ FROM " + tablename
				+ " T WHERE T.JUDGE_STOVE_NO='";
		sql += JudgeStoveNo + "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')";
		sql += " AND T.RESULT_NO ='";
		sql += ResultNo;
		// sql += "' AND T.CHANGE_FLAG='1' ";
		sql += "' AND ( T.COL_SHIFT is null or T.COL_SHIFT='" + Shift + "' )";
		sql += " AND  ( T.COL_GROUP is null or T.COL_GROUP='" + Group + "' )";
		if (process.equals(1) || process.equals(2)) {
			sql += " AND T.COL_NO='";
			sql += colno;
			sql += "'";
		}
		sql += " ORDER BY SEQ ";

		return this.getData(sql);
	}

	public CoreReturnObject GetRackChangeFlag1(String JudgeStoveNo,
			String ResultNo, String Seq, Integer process, String colno,
			String Shift, String Group, String proPlanId, String gxPlanNo) {
		String[] TableNameList = new String[] { "MIL_SAW_RACK",
				"MIL_STRAIGH_RACK", "MIL_TESTING_RACK" };
		String tablename = TableNameList[process];

		String sql = "SELECT MAX(SEQ) AS SEQ FROM " + tablename
				+ " T WHERE T.JUDGE_STOVE_NO='";
		sql += JudgeStoveNo + "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')";
		sql += " AND T.RESULT_NO ='";
		sql += ResultNo;
		sql += "' AND T.CHANGE_FLAG='1' ";
		sql += " AND T.COL_SHIFT ='" + Shift + "'";
		sql += " AND T.COL_GROUP ='" + Group + "'";
		if (process.equals(1) || process.equals(2)) {
			sql += " AND T.COL_NO='";
			sql += colno;
			sql += "'";
		}
		sql += " ORDER BY SEQ ";

		return this.getData(sql);
	}

	public CoreReturnObject GetRackChangeNum(String JudgeStoveNo,
			String ResultNo, String seqlast, String Seq, Integer process,
			String colno, String proPlanId, String gxPlanNo) {
		String[] TableNameList = new String[] { "MIL_SAW_RACK",
				"MIL_STRAIGH_RACK", "MIL_TESTING_RACK" };
		String tablename = TableNameList[process];
		String sql = "SELECT COUNT(JUDGE_STOVE_NO) AS COUNTS FROM " + tablename
				+ " T WHERE   T.JUDGE_STOVE_NO='";
		sql += JudgeStoveNo + "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')";
		sql += " AND T.RESULT_NO ='";
		sql += ResultNo;
		sql += "' AND T.SEQ BETWEEN " + seqlast + " AND " + Seq;
		if (process.equals(1) || process.equals(2)) {
			sql += " AND T.COL_NO='";
			sql += colno;
			sql += "'";
		}
		return this.getData(sql);

	}

	public CoreReturnObject GetRackChangeNumHas(String JudgeStoveNo,
			String ResultNo, Integer process, String colno, String proPlanId,
			String gxPlanNo) {
		String[] TableNameList = new String[] { "MIL_SAW_RACK",
				"MIL_STRAIGH_RACK", "MIL_TESTING_RACK" };
		String tablename = TableNameList[process];
		String sql = "SELECT COUNT(JUDGE_STOVE_NO) AS COUNTS FROM " + tablename
				+ " T WHERE   T.JUDGE_STOVE_NO='";
		sql += JudgeStoveNo + "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')";
		sql += " AND T.RESULT_NO ='";
		sql += ResultNo;
		sql += "' AND T.COL_SHIFT is not null AND T.COL_GROUP is not null AND T.COL_USER is not null";
		// if(process.equals(1)||process.equals(2))
		// {
		// sql+=" AND T.COL_NO='";
		// sql+=colno;
		// sql+="'";
		// }
		return this.getData(sql);
	}

	public CoreReturnObject ChangeShiftNEWW(String JudgeStoveNo,
			String ResultNo, String seqlast, String Seq, String seqchanghas,
			Integer changnum, Integer changnumhas, Integer changnumdel,
			String Shift, String Group, String user, Integer process,
			Integer flag, String colno, String proPlanId, String gxPlanNo) {

		ArrayList<String> sqllist = new ArrayList<String>();
		String seqmin = seqlast;
		String seqmax = Seq;
		int changnumlast = changnumhas + changnum - changnumdel;
		int resultprocess = process + flag - 1;

		String[] RackTableNameList = new String[] { "MIL_SAW_RACK",
				"MIL_STRAIGH_RACK", "MIL_TESTING_RACK" };
		String[] ENDTimeList = new String[] { "END_SAW_TIME",
				"END_STRAIGHTENING_TIME", "END_INSPECTION_TIME" };
		String[] ResultTableNameList = new String[] { "MIL_SAW_RESULT",
				"MIL_STRAIGHTENING_RESULT", "MIL_ET_RESULT", "MIL_MT_RESULT",
				"MIL_UL_RESUL" };
		String racktablename = RackTableNameList[process];
		String resulttablename = ResultTableNameList[resultprocess];
		String endtime = ENDTimeList[process];

		String sql = "UPDATE "
				+ racktablename
				+ " T SET T.COL_SHIFT = ''  , T.COL_GROUP = '' , T.COL_USER='' ,T."
				+ endtime + " = '',  T.CHANGE_FLAG = 0 ";
		sql += " WHERE T.JUDGE_STOVE_NO = '" + JudgeStoveNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')" + " and T.RESULT_NO = '" + ResultNo
				+ "'  AND SEQ  BETWEEN ";
		sql += seqmin + " AND " + seqchanghas;
		if (process.equals(1) || process.equals(2)) {
			sql += " AND T.COL_NO='";
			sql += colno;
			sql += "'";
		}
		String sql1 = "UPDATE " + resulttablename + " T SET T.CHANGE_NUM= "
				+ changnumlast + " WHERE ";
		sql1 += "JUDGE_STOVE_NO = '" + JudgeStoveNo + "' and RESULT_NO = '"
				+ ResultNo + "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')";

		String sql2 = "UPDATE " + racktablename + " T SET T.COL_SHIFT = '"
				+ Shift + "'  , T.COL_GROUP = '" + Group + "' ,T." + endtime
				+ " = SYSDATE ,  ";
		sql2 += " T.COL_USER='" + user + "' ";
		sql2 += "  WHERE T.JUDGE_STOVE_NO = '" + JudgeStoveNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')" + " and T.RESULT_NO = '" + ResultNo
				+ "'  AND SEQ  BETWEEN ";
		sql2 += seqmin + " AND " + seqmax;
		if (process.equals(1) || process.equals(2)) {
			sql2 += " AND T.COL_NO='";
			sql2 += colno;
			sql2 += "'";
		}

		String sql3 = "UPDATE " + racktablename
				+ " T SET T.CHANGE_FLAG='1'  WHERE ";
		sql3 += " T.JUDGE_STOVE_NO = '" + JudgeStoveNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')" + " and  T.RESULT_NO = '" + ResultNo
				+ "'  and T.seq =" + seqmax;
		if ((!seqchanghas.equals(null)) && (!changnumdel.equals(0))) {
			sqllist.add(sql);
		}
		sqllist.add(sql1);
		sqllist.add(sql2);
		sqllist.add(sql3);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);

	}

	public CoreReturnObject ChangeShiftNEW(String JudgeStoveNo,
			String ResultNo, String seqlast, String Seq, Integer changnum,
			String PLineCode, String Shift, String Group, Integer process,
			Integer flag, String colno, String user) {
		ArrayList<String> sqllist = new ArrayList<String>();
		String seqmin = seqlast;
		String seqmax = Seq;
		int resultprocess = process + flag - 1;

		String[] RackTableNameList = new String[] { "MIL_SAW_RACK",
				"MIL_STRAIGH_RACK", "MIL_TESTING_RACK" };
		String[] ENDTimeList = new String[] { "END_SAW_TIME",
				"END_STRAIGHTENING_TIME", "END_INSPECTION_TIME" };
		String[] ResultTableNameList = new String[] { "MIL_SAW_RESULT",
				"MIL_STRAIGHTENING_RESULT", "MIL_ET_RESULT", "MIL_MT_RESULT",
				"MIL_UL_RESUL" };
		String racktablename = RackTableNameList[process];
		String resulttablename = ResultTableNameList[resultprocess];
		String endtime = ENDTimeList[process];

		String sql = "UPDATE "
				+ racktablename
				+ " T SET T.COL_SHIFT = ''  , T.COL_GROUP = '' , T.COL_USER='' ,T."
				+ endtime + " = '',  T.CHANGE_FLAG = 0 ";
		sql += " WHERE T.JUDGE_STOVE_NO = '" + JudgeStoveNo
				+ "' and T.RESULT_NO = '" + ResultNo + "'  AND SEQ  BETWEEN ";
		sql += seqmin + " AND " + seqmax;
		if (process.equals(1) || process.equals(2)) {
			sql += " AND T.COL_NO='";
			sql += colno;
			sql += "'";
		}

		String sql1 = "UPDATE " + resulttablename
				+ " T SET T.CHANGE_NUM= T.CHANGE_NUM + " + changnum + " WHERE ";
		sql1 += "JUDGE_STOVE_NO = '" + JudgeStoveNo + "' and RESULT_NO = '"
				+ ResultNo + "'";

		String sql2 = "UPDATE " + racktablename + " T SET T.COL_SHIFT = '"
				+ Shift + "'  , T.COL_GROUP = '" + Group + "' ,T." + endtime
				+ " = SYSDATE ,  ";
		sql2 += " T.COL_USER='" + user + "' ";
		sql2 += "  WHERE T.JUDGE_STOVE_NO = '" + JudgeStoveNo
				+ "' and T.RESULT_NO = '" + ResultNo + "'  AND SEQ  BETWEEN ";
		sql2 += seqmin + " AND " + seqmax;
		if (process.equals(1) || process.equals(2)) {
			sql2 += " AND T.COL_NO='";
			sql2 += colno;
			sql2 += "'";
		}
		String sql3 = "UPDATE " + racktablename
				+ " T SET T.CHANGE_FLAG='1'  WHERE ";
		sql3 += " T.JUDGE_STOVE_NO = '" + JudgeStoveNo
				+ "' and  T.RESULT_NO = '" + ResultNo + "'  and T.seq ="
				+ seqmax;

		sqllist.add(sql);
		sqllist.add(sql1);
		sqllist.add(sql2);
		sqllist.add(sql3);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);

	}

	public CoreReturnObject ChangeShift(String JudgeStoveNo, String ResultNo,
			String seqlast, String Seq, String PLineCode, String Shift,
			String Group, Integer process, Integer flag) {

		ArrayList<String> sqllist = new ArrayList<String>();
		int seqmin = Integer.parseInt(seqlast);
		seqmin = seqmin + 1;
		int seqmax = Integer.parseInt(Seq);
		int changnum = seqmax - seqmin + 1;
		int resultprocess = process + flag - 1;
		String[] RackTableNameList = new String[] { "MIL_SAW_RACK",
				"MIL_STRAIGH_RACK", "MIL_TESTING_RACK" };
		String[] ENDTimeList = new String[] { "END_SAW_TIME",
				"END_STRAIGHTENING_TIME", "END_INSPECTION_TIME" };
		String[] ResultTableNameList = new String[] { "MIL_SAW_RESULT",
				"MIL_STRAIGHTENING_RESULT", "MIL_ET_RESULT", "MIL_MT_RESULT",
				"MIL_UL_RESUL" };
		String racktablename = RackTableNameList[process];
		String resulttablename = ResultTableNameList[resultprocess];
		String endtime = ENDTimeList[process];

		String sql = "UPDATE " + racktablename
				+ " T SET T.COL_SHIFT = ''  , T.COL_GROUP = ''  ,T." + endtime
				+ " = '',  T.CHANGE_FLAG = 0 ";
		sql += " WHERE T.JUDGE_STOVE_NO = '" + JudgeStoveNo
				+ "' and T.RESULT_NO = '" + ResultNo + "'  AND SEQ  BETWEEN ";
		sql += seqmin;
		sql += " AND " + seqmax;

		String sql1 = "UPDATE " + resulttablename
				+ " T SET T.CHANGE_NUM= T.CHANGE_NUM" + changnum + " WHERE ";
		sql1 += "JUDGE_STOVE_NO = '" + JudgeStoveNo + "' and RESULT_NO = '"
				+ ResultNo + "'";

		String sql2 = "UPDATE " + racktablename + " T SET T.COL_SHIFT = '"
				+ Shift + "'  , T.COL_GROUP = '" + Group + "' ,T." + endtime
				+ " = SYSDATE  where ";
		sql2 += " WHERE T.JUDGE_STOVE_NO = '" + JudgeStoveNo
				+ "' and T.RESULT_NO = '" + ResultNo + "'  AND SEQ  BETWEEN ";
		sql2 += seqmin;
		sql2 += " AND " + seqmax;

		String sql3 = "UPDATE " + racktablename
				+ " T SET T.CHANGE_FLAG='1'  WHERE ";
		sql3 += " T.JUDGE_STOVE_NO = '" + JudgeStoveNo
				+ "' and  T.RESULT_NO = '" + ResultNo + "'  and T.seq ="
				+ seqmax;

		sqllist.add(sql);
		sqllist.add(sql1);
		sqllist.add(sql2);
		sqllist.add(sql3);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);
	}

	public CoreReturnObject BeforeChangBack(String JudgeStoveNo,
			String ResultNo, String PLineCode, String Shift, String Group,
			Integer process, String colno, String proPlanId, String gxPlanNo) {
		String[] TableRackList = new String[] { "MIL_FEED_RACK",
				"MIL_FUR_RACK", "MIL_PERFORATION_RACK", "MIL_ROLLING_RACK",
				"MIL_REFUR_RACK", "MIL_SIZING_RACK", "MIL_SAW_RACK",
				"MIL_STRAIGH_RACK", "MIL_TESTING_RACK", "MIL_QA_RACK" };// 7-8-9涉及到分台
		String tablenamerack = TableRackList[process];
		String sql = "SELECT JUDGE_STOVE_NO FROM " + tablenamerack
				+ "  WHERE JUDGE_STOVE_NO='" + JudgeStoveNo + "'";
		sql += "  AND RESULT_NO='" + ResultNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')";
		if (process.equals(1) || process.equals(4)) {
			sql += " AND (IN_CHANGE_FLAG='2' OR OUT_CHANGE_FLAG='2')";
		} else {
			sql += " AND CHANGE_FLAG='2'";
		}
		if (process.equals(7)) {
			sql += " AND COL_NO='" + colno + "'";
		}
		return this.getData(sql);
	}

	public CoreReturnObject ChangBackelse(String JudgeStoveNo, String ResultNo,
			String PLineCode, String Shift, String Group, Integer process,
			String colno, String proPlanId, String gxPlanNo) {
		String[] TableRackList = new String[] { "MIL_FEED_RACK",
				"MIL_FUR_RACK", "MIL_PERFORATION_RACK", "MIL_ROLLING_RACK",
				"MIL_REFUR_RACK", "MIL_SIZING_RACK", "MIL_SAW_RACK",
				"MIL_STRAIGH_RACK", "MIL_TESTING_RACK", "MIL_QA_RACK" };// 7-8-9涉及到分台
		String tablenamerack = TableRackList[process];
		String sql = " UPDATE " + tablenamerack + " SET ";
		if (process.equals(1) || process.equals(4)) {
			sql += " IN_CHANGE_FLAG='0' , OUT_CHANGE_FLAG='0' ";
		} else {
			sql += " CHANGE_FLAG='0' ";
		}
		sql += "  WHERE JUDGE_STOVE_NO='" + JudgeStoveNo + "' AND RESULT_NO='"
				+ ResultNo + "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')";
		if (process.equals(1) || process.equals(4)) {
			sql += " AND (IN_CHANGE_FLAG='2' OR OUT_CHANGE_FLAG='2')";
		} else {
			sql += " AND CHANGE_FLAG='2'";
		}
		if (process.equals(7)) {
			sql += " AND COL_NO='" + colno + "'";
		}
		return this.setData(sql);

	}

	public CoreReturnObject GetChangeShiftBackNum(String JudgeStoveNo,
			String ResultNo, String PLineCode, String Shift, String Group,
			Integer process, String colno, String proPlanId, String gxPlanNo) {
		String[] TableRackList = new String[] { "MIL_FEED_RACK",
				"MIL_FUR_RACK", "MIL_PERFORATION_RACK", "MIL_ROLLING_RACK",
				"MIL_REFUR_RACK", "MIL_SIZING_RACK", "MIL_SAW_RACK",
				"MIL_STRAIGH_RACK", "MIL_TESTING_RACK", "MIL_QA_RACK" };// 7-8-9涉及到分台
		String tablenamerack = TableRackList[process];
		String sql = "SELECT COUNT(JUDGE_STOVE_NO) AS COUNTS FROM "
				+ tablenamerack + " T WHERE T.JUDGE_STOVE_NO='";
		sql += JudgeStoveNo + "' AND T.RESULT_NO='" + ResultNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')" + " AND T.COL_SHIFT=" + Shift + "  AND T.COL_GROUP="
				+ Group;
		if (process.equals("7")) {
			sql += " AND T.COL_NO='" + colno + "'";
		}
		return this.getData(sql);

	}

	public CoreReturnObject GetChangeShiftBackNuminfur(String JudgeStoveNo,
			String ResultNo, String PLineCode, String Shift, String Group,
			Integer process, String colno, String proPlanId, String gxPlanNo) {
		String tablenamerack = "";
		if (process.equals(1)) {
			tablenamerack = "MIL_FUR_RACK";
		}
		if (process.equals(4)) {
			tablenamerack = "MIL_REFUR_RACK";
		}
		String sql = "";
		if (process.equals(1) || process.equals(4)) {
			sql = "SELECT COUNT(JUDGE_STOVE_NO) AS COUNTS FROM "
					+ tablenamerack + " T WHERE T.JUDGE_STOVE_NO='";
			sql += JudgeStoveNo + "' AND T.RESULT_NO='" + ResultNo
					+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
					+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
					+ "','/')" + " AND T.IN_SHIFT=" + Shift
					+ "  AND T.IN_GROUP=" + Group;
		}
		return this.getData(sql);
	}

	public CoreReturnObject ChangeShiftBackCheck(String JudgeStoveNo,
			String ResultNo, String PLineCode, String Shift, String Group,
			Integer process, String colno) {
		String[] TableRackList = new String[] { "MIL_FEED_RACK",
				"MIL_FUR_RACK", "MIL_PERFORATION_RACK", "MIL_ROLLING_RACK",
				"MIL_REFUR_RACK", "MIL_SIZING_RACK", "MIL_SAW_RACK",
				"MIL_STRAIGH_RACK", "MIL_TESTING_RACK", "MIL_QA_RACK" };
		String tablerack = TableRackList[process];
		String sql = "";
		if (process == 1 || process == 4) {
			sql = "SELECT (T.Out_Change_Flag+T.In_Change_Flag) AS CHANGFLAG FROM  "
					+ " T WHERE  T.JUDGE_STOVE_NO='"
					+ JudgeStoveNo
					+ "' AND T.RESULT_NO='" + ResultNo + "'";
			sql += "  AND (T.COL_SHIFT=" + Shift + " OR T.In_Shift= " + Shift
					+ " ) AND (T.COL_GROUP=" + Group + " OR T.IN_GROUP= "
					+ Group;
			sql += " ) AND (T.OUT_CHANGE_FLAG=1 OR T.IN_CHANGE_FLAG=1 ) ";
		} else {
			sql = "SELECT T.CHANGE_FLAG AS CHANGFLAG FROM " + tablerack
					+ " T WHERE  T.JUDGE_STOVE_NO='" + JudgeStoveNo
					+ "' AND T.RESULT_NO='" + ResultNo + "'";
			sql += " AND T.CHANGE_FLAG=1 AND T.COL_SHIFT=" + Shift
					+ " AND T.COL_GROUP=" + Group;

			if (process == 7 || process == 8) {
				sql += " AND T.COL_NO=" + colno;
			}
		}
		return this.getData(sql);
	}

	public CoreReturnObject ChangeShiftBack(String JudgeStoveNo,
			String ResultNo, String PLineCode, String Shift, String Group,
			Integer process, Integer changnumhas, Integer changnumhasInfur,
			String colno, String proPlanId, String gxPlanNo) {
		ArrayList<String> sqllist = new ArrayList<String>();
		String[] TableRackList = new String[] { "MIL_FEED_RACK",
				"MIL_FUR_RACK", "MIL_PERFORATION_RACK", "MIL_ROLLING_RACK",
				"MIL_REFUR_RACK", "MIL_SIZING_RACK", "MIL_SAW_RACK",
				"MIL_STRAIGH_RACK", "MIL_TESTING_RACK", "MIL_QA_RACK" };
		String[] TableNameList = new String[] { "MIL_FEEDSAW_RESULT",
				"MIL_FUR_Result", "MIL_PERFORATION_Result",
				"MIL_ROLLING_Result", "MIL_REFUR_Result", "MIL_SIZING_Result",
				"MIL_SAW_Result", "MIL_STRAIGHTENING_RESULT", "MIL_ET_RESULT",
				"MIL_MT_RESULT", "MIL_UL_RESUL", "MIL_SURFACE_RESULT" };
		String[] StartTimeList = new String[] { "FEED_TIME", "IN_FUR_TIME",
				"START_PERFORATION_TIME", "START_ROLLING_TIME",
				"IN_REFUR_TIME", "START_SIZING_TIME", "START_SAW_TIME",
				"START_STRAIGHTENING_TIME", "START_INSPECTION_TIME",
				"START_TIME" };
		String[] EndTimeList = new String[] { "END_TIME", "OUT_FUR_TIME",
				"END_PERFORATION_TIME", "END_ROLLING_TIME", "OUT_REFUR_TIME",
				"END_SIZING_TIME", "END_SAW_TIME", "END_STRAIGHTENING_TIME",
				"END_INSPECTION_TIME", "END_TIME" };
		String changstring = "";
		String starttime = StartTimeList[process];
		String endtime = EndTimeList[process];
		String tablerack = TableRackList[process];
		String tableresult = "";
		if (process.equals(2)) {
			changstring = "JZB_NUM";
		} else if (process.equals(3)) {
			changstring = "CHANGECLASSNUM";
		} else {
			changstring = "CHANGE_NUM";
		}
		if (process < 8) {
			tableresult = TableNameList[process];
		} else if (process.equals(8)) {
			if (PLineCode.equals("C008") || PLineCode.equals("C009")
					|| PLineCode.equals("C012")) {
				tableresult = "MIL_MT_RESULT";
			} else if (PLineCode.equals("C010")) {
				tableresult = "MIL_ET_RESULT";
			} else {
				tableresult = "MIL_UL_RESUL";
			}
		} else {
			tableresult = TableNameList[11];
		}
		String sql1 = "UPDATE " + tableresult + " T SET ";
		if (process.equals(1)) {
			sql1 += " T.CHANGE_NUM=T.CHANGE_NUM-" + changnumhasInfur;
			sql1 += " , T.OUT_CHANGE_NUM=T.OUT_CHANGE_NUM-" + changnumhas;
		} else if (process.equals(4)) {
			sql1 += " T.CHANGECLASSNUM=T.CHANGECLASSNUM-" + changnumhasInfur;
			sql1 += " , T.OUT_CHANGE_NUM=T.OUT_CHANGE_NUM-" + changnumhas;
		} else {
			sql1 += " T." + changstring + "=T." + changstring + " - "
					+ changnumhas;
		}
		sql1 += "  WHERE JUDGE_STOVE_NO = '" + JudgeStoveNo
				+ "' and RESULT_NO = '" + ResultNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')";
		String ChangeFlag = "CHANGE_FLAG";
		if (process.equals(1) || process.equals(4)) {
			ChangeFlag = "OUT_CHANGE_FLAG ";

		}
		String sql = "UPDATE "
				+ tablerack
				+ " T SET T.COL_SHIFT = ''  , T.COL_GROUP = '' , T.COL_USER='' ,T."
				+ endtime + " = '', " + ChangeFlag + " = 0 ";
		sql += " WHERE T.JUDGE_STOVE_NO = '" + JudgeStoveNo
				+ "' and T.RESULT_NO = '" + ResultNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')";
		sql += " AND T.COL_SHIFT =" + Shift + " AND T.COL_GROUP=" + Group;
		// if (process.equals(7) || process.equals(8)) {
		// sql += " AND T.COL_NO='" + colno + "'";
		// }
		if (process.equals(7)) {
			sql += " AND T.COL_NO='" + colno + "'";
		}
		String sql2 = "";
		sqllist.add(sql1);
		sqllist.add(sql);
		if (process.equals(1) || process.equals(4)) {
			sql2 += " UPDATE "
					+ tablerack
					+ " T "
					+ "  SET  T.IN_SHIFT = ''  , T.IN_USER='', T.IN_GROUP = ''  ,T.IN_CHANGE_FLAG = 0, ";
			if (process.equals(1)) {
				sql2 += "T.IN_FUR_TIME";
			} else {
				sql2 += "T.IN_REFUR_TIME";
			}
			sql2 += " =(SELECT A.IN_FUR_TIME  FROM MIL_FUR_RACK A WHERE A.JUDGE_STOVE_NO = T.JUDGE_STOVE_NO  AND A.RESULT_NO = T.RESULT_NO AND A.SEQ = 1)  ";
			sql2 += " WHERE T.JUDGE_STOVE_NO = '" + JudgeStoveNo
					+ "' and T.RESULT_NO = '" + ResultNo
					+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
					+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
					+ "','/')";
			sql2 += " AND T.IN_SHIFT =" + Shift + " AND T.IN_GROUP=" + Group;
			sqllist.add(sql2);
		}
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);
	}

	public CoreReturnObject NodeBackGetMaxChangFlag(String JudgeStoveNo,
			String ResultNo, Integer process, String colno, String proPlanId,
			String gxPlanNo) {
		String sql = "SELECT MAX(SEQ) AS SEQ  FROM ";
		if (process.equals(0)) {
			sql += "MIL_STRAIGH_RACK T ";
		}
		if (process.equals(1)) {
			sql += "MIL_TESTING_RACK T ";
		}
		sql += " WHERE T.JUDGE_STOVE_NO = '" + JudgeStoveNo
				+ "' and T.RESULT_NO = '" + ResultNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')";
		sql += "  AND T.COL_NO=" + colno;
		sql += "  AND T.CHANGE_FLAG=1";
		return this.getData(sql);
	}

	public CoreReturnObject NodeBack(String JudgeStoveNo, String ResultNo,
			String PLineCode, Integer process, String seq, String colno,
			Integer bProcessNo, String proPlanId, String gxPlanNo, String lotNo) {
		ArrayList<String> sqllist = new ArrayList<String>();
		String tableresult = "";
		String tablerack = "";
		String tablerackafter = "";
		String NodeStatus = "";
		String slabprocess = "";
		String endtime = "";
		if (process.equals(0)) {
			tableresult = "MIL_STRAIGHTENING_RESULT";
			tablerack = "MIL_STRAIGH_RACK";
			tablerackafter = "MIL_TESTING_RACK";
			NodeStatus = "70";
			slabprocess = "9";
			endtime = "END_STRAIGHTENING_TIME";
		}
		if (process.equals(1)) {
			tablerack = "MIL_TESTING_RACK";
			tablerackafter = "MIL_QA_RACK";
			NodeStatus = "80";
			slabprocess = "10";
			endtime = "END_INSPECTION_TIME";
			if (PLineCode.equals("C008") || PLineCode.equals("C009")
					|| PLineCode.equals("C012")) {
				tableresult = "MIL_MT_RESULT";
			} else if (PLineCode.equals("C010")) {
				tableresult = "MIL_ET_RESULT";
			} else {
				tableresult = "MIL_UL_RESUL";
			}
		}
		String sql = "";
		String sql1 = "";
		String sql2 = "";
		String sql3 = "";
		String sql4 = "";
		sql = "update MIL_PLAN set NODE_STATUS = '" + NodeStatus
				+ "' where JUDGE_STOVE_NO = '" + JudgeStoveNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')" + "  AND ID = '" + ResultNo + "'";

		if (process.equals(0)) {
			sql1 = "update "
					+ tableresult
					+ " set NODE_FUR_FLAG = '0' ,END_TIME = '' , QUALIFIED_NUM1 =0, QUALIFIED_NUM2=0,QUALIFIED_NUM3=0,QUALIFIED_NUM =0,IN_MAT_NUM=0,QA_TON=0  WHERE JUDGE_STOVE_NO = '"
					+ JudgeStoveNo + "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
					+ proPlanId + "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
					+ gxPlanNo + "','/')" + "  AND RESULT_NO = '" + ResultNo
					+ "' ";
		}
		if (process.equals(1)) {
			sql1 = "update "
					+ tableresult
					+ " set NODE_FUR_FLAG = '0' ,END_TIME = '' , QA_TON=0,QUALIFIED_NUM1  =0, QUALIFIED_NUM2 =0,";
			sql1 += " QUALIFIED_NUM = 0,DETECTION_NUM1 = 0,DETECTION_NUM2 = 0 ,DETECTION_NUM =0 ";
			if (PLineCode.equals("C010")) {
				sql1 += ",DETECTION_NUM3 =0,QUALIFIED_NUM3 =0 ";
			}
			if (colno.equals("1")) {
				sql1 += " ,NODE_FUR_FLAG1=0";
			}
			if (colno.equals("2")) {
				sql1 += " ,NODE_FUR_FLAG2=0";
			}
			if (colno.equals("3")) {
				sql1 += " ,NODE_FUR_FLAG3=0";
			}

			sql1 += " WHERE JUDGE_STOVE_NO = '" + JudgeStoveNo
					+ "'  AND RESULT_NO = '" + ResultNo
					+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
					+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
					+ "','/')";
		}

		sql2 = "DELETE MIL_SLAB_SCRAP  WHERE JUDGE_STOVE_NO = '" + JudgeStoveNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')" + "  AND PROCESS_NO = '" + slabprocess + "'";

		sql3 = "update " + tablerackafter
				+ " set MAT_NO = ''  where JUDGE_STOVE_NO = '" + JudgeStoveNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')";
		sql4 = " update " + tablerack
				+ "  set COL_SHIFT = '' , COL_GROUP = '', COL_USER='' ,"
				+ endtime + " = '' WHERE   JUDGE_STOVE_NO = '" + JudgeStoveNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')" + "  and RESULT_NO = '" + ResultNo + "'  and seq > "
				+ seq + "  AND COL_NO=" + colno;
		String sql15 = " UPDATE PORT_MIL_BATCH_SAMPLE_RESULT T SET T.STATUS = '0',T.OP_PROCESS = '' WHERE T.JUDGE_STOVE_NO = '"
				+ JudgeStoveNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
				+ proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
				+ gxPlanNo
				+ "','/')"
				+ " AND T.PLAN_ID = '"
				+ ResultNo
				+ "' AND T.OP_PROCESS = '" + String.valueOf(bProcessNo) + "'";

		// 更新进程表mil_processes数据
		String updateProcess = CoreXmlSqlParsersFactory
				.getSql("FrmInOnlineStore.insertMilProcess2");
		updateProcess = updateProcess.replace("#JUDGE_STOVE_NO#", JudgeStoveNo)
				.replace("#LOT_NO#", lotNo).replace("#PLINE_CODE#", PLineCode)
				.replace("#PRO_PLAN_ID#", proPlanId).replace("#GX_PLAN_NO#",
						gxPlanNo);

		sqllist.add(sql);
		sqllist.add(sql1);
		sqllist.add(sql2);
		sqllist.add(sql3);
		sqllist.add(sql4);
		sqllist.add(sql15);
		sqllist.add(updateProcess);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);
	}

	public CoreReturnObject GetQueryNodefurresult(String heatno) {
		String sql = "select t.* from MIL_STRAIGHTENING_RESULT t WHERE t.judge_stove_no='";
		sql += heatno;
		sql += "'";
		return this.getData(sql);
	}

	public CoreReturnObject QunumET(MilEtResultEntity milet, String colno) {
		String sql = "";
		if (colno.equals("1")) {
			sql = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.QunumET1");
		}
		if (colno.equals("2")) {
			sql = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.QunumET2");
		}
		if (colno.equals("3")) {
			sql = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.QunumET3");
		}
		sql = EntityTool.fillSqlByEntity(sql, milet);

		return this.setData(sql);
	}

	public CoreReturnObject QunumMT(MilMtResultEntity milmt, String colno) {
		String sql = "";
		if (colno.equals("1")) {
			sql = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.QunumMT1");
		}
		if (colno.equals("2")) {
			sql = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.QunumMT2");
		}
		sql = EntityTool.fillSqlByEntity(sql, milmt);

		return this.setData(sql);
	}

	public CoreReturnObject QunumUT(MilUlResulEntity milul, String colno) {
		String sql = "";
		if (colno.equals("1")) {
			sql = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.QunumUT1");
		}
		if (colno.equals("2")) {
			sql = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.QunumUT2");
		}
		sql = EntityTool.fillSqlByEntity(sql, milul);

		return this.setData(sql);
	}

	public CoreReturnObject CheckIpAddress(String procee, String clono,
			String plcode) {
		String sql = "SELECT *  FROM MIL_BASE_ADDRESS T WHERE T.PROCESS_NO='"
				+ procee;
		sql += "'	 AND T.OPERAT_CODE='" + clono + "'  AND T.PLINE_CODE='";
		sql += plcode + "'";
		return this.getData(sql);
	}

	public CoreReturnObject CheckIpAddressisin(MilBaseAddressEntity MilBase) {
		String sql = "";
		sql = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.CheckIpAddressisin");
		sql = EntityTool.fillSqlByEntity(sql, MilBase);
		return this.getData(sql);
	}

	public CoreReturnObject UpdateChangeFlag(String JudgeStvoeNo,
			String ResultNo, Integer ProcessNo, Integer Seq, String Colno) {
		ArrayList<String> sqllist = new ArrayList<String>();
		String[] TableRackList = new String[] { "MIL_STRAIGH_RACK",
				"MIL_TESTING_RACK" };
		String sql1 = "update    " + TableRackList[ProcessNo]
				+ "  set CHANGE_FLAG = '0'  WHERE JUDGE_STOVE_NO = '"
				+ JudgeStvoeNo + "' AND Result_no = '" + ResultNo
				+ "' AND CHANGE_FLAG = '2' AND Col_No='" + Colno + "' ";
		String sql = "update    " + TableRackList[ProcessNo]
				+ "  set CHANGE_FLAG = '2'  WHERE JUDGE_STOVE_NO = '"
				+ JudgeStvoeNo + "' AND Result_no = '" + ResultNo
				+ "' AND SEQ = '" + Seq + "' AND Col_No='" + Colno + "' ";

		sqllist.add(sql1);
		sqllist.add(sql);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);
	}

	public CoreReturnObject GetWaitChangeSeq(String JudgeStvoeNo,
			String ResultNo, Integer ProcessNo, String Colno, String proPlanId,
			String gxPlanNo) {
		ArrayList<String> sqllist = new ArrayList<String>();
		String[] TableRackList = new String[] { "MIL_STRAIGH_RACK",
				"MIL_TESTING_RACK" };
		String sql = "SELECT Seq FROM " + TableRackList[ProcessNo]
				+ " WHERE JUDGE_STOVE_NO = '" + JudgeStvoeNo
				+ "' AND Result_no = '" + ResultNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')" + " AND Col_No='" + Colno
				+ "' AND CHANGE_FLAG = '2' ";
		return this.getData(sql);
	}

	public CoreReturnObject RemoveRackColno(String heatno, String resultno,
			String proPlanId, String gxPlanNo) {
		String sql = "UPDATE MIL_TESTING_RACK T SET T.COL_NO='' WHERE T.JUDGE_STOVE_NO = '"
				+ heatno
				+ "'  AND T.RESULT_NO = '"
				+ resultno
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
				+ proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
				+ gxPlanNo
				+ "','/')";
		return this.setData(sql);
	}

	/**
	 * 保存(插入)明细
	 * 
	 * @param arr
	 * @return
	 */
	public CoreReturnObject InsetTestResultdetail(ArrayList arr,
			String TestMethod) {
		ArrayList<String> sqllist = new ArrayList();
		ArrayList<MilTestingResultDetailDesEntity> listdes1 = (ArrayList<MilTestingResultDetailDesEntity>) arr
				.get(1);
		ArrayList<MilTestingResultDetailDesEntity> listdes2 = (ArrayList<MilTestingResultDetailDesEntity>) arr
				.get(2);
		MilTestingResultDetailEntity detail = (MilTestingResultDetailEntity) arr
				.get(0);
		// /---------保存明细
		String sql1 = "";
		String sql2 = "";
		if (isinsertdetail(detail)) {
			sql1 = "UPDATE MIL_TESTING_RESULT_DETAIL SET ";
			if (detail.getColNo().equals("1")) {
				sql1 += " SCRAP_NUM1=" + detail.getScrapNum1()
						+ " , QUALIFIED_NUM1=" + detail.getQualifiedNum1()
						+ " ,REINSPECTION_NUM1=" + detail.getReinspectionNum1();
				sql1 += " ,REINSPECTION_QUALIFIED_NUM1="
						+ detail.getReinspectionQualifiedNum1()
						+ ", DETECTION_NUM1=" + detail.getDetectionNum1()
						+ " ,SUSPECT_PRODUCT_NUM1="
						+ detail.getSuspectProductNum1();
				sql1 += " ,RECUT_NUM1=" + detail.getRecutNum1();
				sql1 += " , SCRAP_NUM=SCRAP_NUM2+SCRAP_NUM3+"
						+ detail.getScrapNum1()
						+ " , QUALIFIED_NUM=QUALIFIED_NUM3+QUALIFIED_NUM2+"
						+ detail.getQualifiedNum1()
						+ " ,REINSPECTION_NUM=REINSPECTION_NUM2+REINSPECTION_NUM3+"
						+ detail.getReinspectionNum1();
				sql1 += " ,REINSPECTION_QUALIFIED_NUM=REINSPECTION_QUALIFIED_NUM2+REINSPECTION_QUALIFIED_NUM3+"
						+ detail.getReinspectionQualifiedNum1()
						+ ", DETECTION_NUM=DETECTION_NUM2+DETECTION_NUM3+"
						+ detail.getDetectionNum1()
						+ " ,SUSPECT_PRODUCT_NUM=SUSPECT_PRODUCT_NUM2+SUSPECT_PRODUCT_NUM3+"
						+ detail.getSuspectProductNum1();
				sql1 += " ,RECUT_NUM=RECUT_NUM2+RECUT_NUM3+"
						+ detail.getRecutNum1();
			}
			if (detail.getColNo().equals("2")) {
				sql1 += " SCRAP_NUM2=" + detail.getScrapNum2()
						+ " , QUALIFIED_NUM2=" + detail.getQualifiedNum2()
						+ " ,REINSPECTION_NUM2=" + detail.getReinspectionNum2();
				sql1 += " ,REINSPECTION_QUALIFIED_NUM2="
						+ detail.getReinspectionQualifiedNum2()
						+ ", DETECTION_NUM2=" + detail.getDetectionNum2()
						+ " ,SUSPECT_PRODUCT_NUM2="
						+ detail.getSuspectProductNum2();
				sql1 += " ,RECUT_NUM2=" + detail.getRecutNum2();
				sql1 += " , SCRAP_NUM=SCRAP_NUM1+SCRAP_NUM3+"
						+ detail.getScrapNum2()
						+ " , QUALIFIED_NUM=QUALIFIED_NUM3+QUALIFIED_NUM1+"
						+ detail.getQualifiedNum2()
						+ " ,REINSPECTION_NUM=REINSPECTION_NUM1+REINSPECTION_NUM3+"
						+ detail.getReinspectionNum2();
				sql1 += " ,REINSPECTION_QUALIFIED_NUM=REINSPECTION_QUALIFIED_NUM1+REINSPECTION_QUALIFIED_NUM3+"
						+ detail.getReinspectionQualifiedNum2()
						+ ", DETECTION_NUM=DETECTION_NUM1+DETECTION_NUM3+"
						+ detail.getDetectionNum2()
						+ " ,SUSPECT_PRODUCT_NUM=SUSPECT_PRODUCT_NUM1+SUSPECT_PRODUCT_NUM3+"
						+ detail.getSuspectProductNum2();
				sql1 += " ,RECUT_NUM=RECUT_NUM1+RECUT_NUM3+"
						+ detail.getRecutNum2();
			}
			if (detail.getColNo().equals("3")) {
				sql1 += " SCRAP_NUM3=" + detail.getScrapNum3()
						+ " , QUALIFIED_NUM3=" + detail.getQualifiedNum3()
						+ " ,REINSPECTION_NUM3=" + detail.getReinspectionNum3();
				sql1 += " ,REINSPECTION_QUALIFIED_NUM3="
						+ detail.getReinspectionQualifiedNum3()
						+ ", DETECTION_NUM3=" + detail.getDetectionNum3()
						+ " ,SUSPECT_PRODUCT_NUM3="
						+ detail.getSuspectProductNum3();
				sql1 += " ,RECUT_NUM3= 0";
				sql1 += " ,SCRAP_NUM=SCRAP_NUM1+SCRAP_NUM2+"
						+ detail.getScrapNum3()
						+ " , QUALIFIED_NUM=QUALIFIED_NUM2+QUALIFIED_NUM1+"
						+ detail.getQualifiedNum3()
						+ " ,REINSPECTION_NUM=REINSPECTION_NUM1+REINSPECTION_NUM2+"
						+ detail.getReinspectionNum3();
				sql1 += " ,REINSPECTION_QUALIFIED_NUM=REINSPECTION_QUALIFIED_NUM1+REINSPECTION_QUALIFIED_NUM2+"
						+ detail.getReinspectionQualifiedNum3()
						+ ", DETECTION_NUM=DETECTION_NUM1+DETECTION_NUM2+"
						+ detail.getDetectionNum3()
						+ " ,SUSPECT_PRODUCT_NUM=SUSPECT_PRODUCT_NUM1+SUSPECT_PRODUCT_NUM2+"
						+ detail.getSuspectProductNum3();
				sql1 += " ,RECUT_NUM=RECUT_NUM1+RECUT_NUM2+" + 0;
			}
			sql1 += " WHERE JUDGE_STOVE_NO='" + detail.getJudgeStoveNo()
					+ "' AND PLINE_CODE='" + detail.getPlineCode() + "'";
			sql1 += " AND  COL_SHIFT='" + detail.getColShift()
					+ "' AND COL_GROUP='" + detail.getColGroup() + "'";
			sqllist.add(sql1);
		} else {
			if (detail.getColNo().equals("1")) {
				sql1 = CoreXmlSqlParsersFactory
						.getSql("FrmEddyCurrentTestingResult.Insertdetail1");
			}
			if (detail.getColNo().equals("2")) {
				sql1 = CoreXmlSqlParsersFactory
						.getSql("FrmEddyCurrentTestingResult.Insertdetail2");
			}
			if (detail.getColNo().equals("3")) {
				sql1 = CoreXmlSqlParsersFactory
						.getSql("FrmEddyCurrentTestingResult.Insertdetail3");
			}
			sql1 = EntityTool.fillSqlByEntity(sql1, detail);
			sqllist.add(sql1);
		}
		sql2 += " DELETE FROM MIL_TESTING_RESULT_DETAIL_DES ";
		sql2 += "WHERE JUDGE_STOVE_NO='" + detail.getJudgeStoveNo()
				+ "' AND PLINE_CODE='" + detail.getPlineCode() + "'";
		sql2 += " AND  COL_SHIFT='" + detail.getColShift()
				+ "' AND  COL_GROUP='" + detail.getColGroup()
				+ "' AND COL_NO ='" + detail.getColNo() + "'";
		sqllist.add(sql2);
		for (int i = 0; i < listdes1.size(); i++) {
			MilTestingResultDetailDesEntity des = new MilTestingResultDetailDesEntity();
			des = listdes1.get(i);
			String sql3 = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.Insertdetaildse");
			sql3 = EntityTool.fillSqlByEntity(sql3, des);
			sqllist.add(sql3);
		}
		for (int i = 0; i < listdes2.size(); i++) {
			MilTestingResultDetailDesEntity des = new MilTestingResultDetailDesEntity();
			des = listdes2.get(i);
			String sql4 = CoreXmlSqlParsersFactory
					.getSql("FrmEddyCurrentTestingResult.Insertdetaildse");
			sql4 = EntityTool.fillSqlByEntity(sql4, des);
			sqllist.add(sql4);
		}
		// //---------更新实绩
		String sql5 = "SELECT SUM(SCRAP_NUM1) AS  SCRAP_NUM1,SUM(QUALIFIED_NUM1) AS  QUALIFIED_NUM1,SUM(REINSPECTION_NUM1) AS  REINSPECTION_NUM1"
				+ ",SUM(REINSPECTION_QUALIFIED_NUM1) AS  REINSPECTION_QUALIFIED_NUM1,SUM(OFFLINE_NUM1) AS  OFFLINE_NUM1,SUM(BACKLINE_NUM1) AS  BACKLINE_NUM1"
				+ ",SUM(DETECTION_NUM1) AS DETECTION_NUM1,SUM(SUSPECT_PRODUCT_NUM1) AS  SUSPECT_PRODUCT_NUM1,SUM(RECUT_NUM1) AS RECUT_NUM1"
				+ ",SUM(SCRAP_NUM2) AS SCRAP_NUM2,SUM(QUALIFIED_NUM2) AS QUALIFIED_NUM2,SUM(REINSPECTION_NUM2) AS REINSPECTION_NUM2"
				+ ",SUM(REINSPECTION_QUALIFIED_NUM2) AS REINSPECTION_QUALIFIED_NUM2,SUM(OFFLINE_NUM2) AS OFFLINE_NUM2,SUM(BACKLINE_NUM2) AS BACKLINE_NUM2"
				+ ",SUM(DETECTION_NUM2) AS DETECTION_NUM2,SUM(SUSPECT_PRODUCT_NUM2) AS SUSPECT_PRODUCT_NUM2,SUM(RECUT_NUM2) AS RECUT_NUM2"
				+ ",SUM(SCRAP_NUM3) AS SCRAP_NUM3,SUM(QUALIFIED_NUM3) AS QUALIFIED_NUM3,SUM(REINSPECTION_NUM3) AS REINSPECTION_NUM3"
				+ ",SUM(REINSPECTION_QUALIFIED_NUM3) AS REINSPECTION_QUALIFIED_NUM3,SUM(OFFLINE_NUM3) AS OFFLINE_NUM3,SUM(BACKLINE_NUM3) AS BACKLINE_NUM3"
				+ ",SUM(DETECTION_NUM3) AS DETECTION_NUM3,SUM(SUSPECT_PRODUCT_NUM3) AS SUSPECT_PRODUCT_NUM3,SUM(RECUT_NUM3) AS RECUT_NUM3"
				+ ",SUM(SCRAP_NUM) AS SCRAP_NUM,SUM(QUALIFIED_NUM) AS QUALIFIED_NUM,SUM(REINSPECTION_NUM) AS REINSPECTION_NUM"
				+ ",SUM(REINSPECTION_QUALIFIED_NUM) AS REINSPECTION_QUALIFIED_NUM,SUM(OFFLINE_NUM) AS OFFLINE_NUM,SUM(BACKLINE_NUM) AS BACKLINE_NUM"
				+ ",SUM(DETECTION_NUM) AS DETECTION_NUM,SUM(SUSPECT_PRODUCT_NUM) AS SUSPECT_PRODUCT_NUM,SUM(RECUT_NUM) AS RECUT_NUM ";
		sql5 += " FROM MIL_TESTING_RESULT_DETAIL WHERE JUDGE_STOVE_NO='"
				+ detail.getJudgeStoveNo() + "' AND PLINE_CODE='"
				+ detail.getPlineCode() + "'";
		String sql = "MERGE INTO ";
		if (TestMethod.contains("涡流"))// ET
		{
			sql += " MIL_ET_RESULT T1";
		}
		if (TestMethod.contains("漏磁"))// MT
		{
			sql += " MIL_MT_RESULT T1";
		}
		if (TestMethod.contains("超声波"))// UL
		{
			sql += " MIL_UL_RESUL T1";
		}
		sql += " USING ( " + sql5 + " ) T2 ON (T1.JUDGE_STOVE_NO='"
				+ detail.getJudgeStoveNo() + "' AND T1.PLINE_CODE='"
				+ detail.getPlineCode() + "' ) WHEN MATCHED THEN ";
		sql += " UPDATE SET  T1.SCRAP_NUM1=(CASE T2.SCRAP_NUM1 WHEN null THEN 0 ELSE T2.SCRAP_NUM1 END),T1.QUALIFIED_NUM1=( CASE T2.QUALIFIED_NUM1 WHEN null THEN 0 ELSE T2.QUALIFIED_NUM1 END),T1.REINSPECTION_NUM1= (CASE T2.REINSPECTION_NUM1 WHEN null THEN 0 ELSE T2.REINSPECTION_NUM1 END )"
				+ ",T1.REINSPECTION_QUALIFIED_NUM1=(CASE T2.REINSPECTION_QUALIFIED_NUM1 WHEN null THEN 0 ELSE T2.REINSPECTION_QUALIFIED_NUM1 END),T1.DETECTION_NUM1=(CASE T2.DETECTION_NUM1 WHEN null THEN 0 ELSE T2.DETECTION_NUM1 END),T1.SUSPECT_PRODUCT_NUM1=(CASE T2.SUSPECT_PRODUCT_NUM1 WHEN null THEN 0 ELSE T2.SUSPECT_PRODUCT_NUM1 END )"
				+ ",T1.RECUT_NUM1=(CASE T2.RECUT_NUM1 WHEN null THEN 0 ELSE T2.RECUT_NUM1 END ) ,T1.SCRAP_NUM2=(CASE T2.SCRAP_NUM2 WHEN null THEN 0 ELSE T2.SCRAP_NUM2 END ),T1.QUALIFIED_NUM2=(CASE T2.QUALIFIED_NUM2 WHEN null THEN 0 ELSE T2.QUALIFIED_NUM2 END) ,T1.REINSPECTION_NUM2=(CASE T2.REINSPECTION_NUM2 WHEN null THEN 0 ELSE  T2.REINSPECTION_NUM2 END )"
				+ ",T1.REINSPECTION_QUALIFIED_NUM2= (CASE T2.REINSPECTION_QUALIFIED_NUM2 WHEN null THEN 0 ELSE T2.REINSPECTION_QUALIFIED_NUM2 END),T1.DETECTION_NUM2=(CASE  T2.DETECTION_NUM2 WHEN null THEN 0 ELSE T2.DETECTION_NUM2 END ),T1.SUSPECT_PRODUCT_NUM2=(CASE T2.SUSPECT_PRODUCT_NUM2 WHEN null THEN 0 ELSE T2.SUSPECT_PRODUCT_NUM2 END )"
				+ ",T1.RECUT_NUM2=(CASE T2.RECUT_NUM2 WHEN null THEN 0 ELSE T2.RECUT_NUM2 END ) ,T1.SCRAP_NUM=(CASE T2.SCRAP_NUM WHEN null THEN 0 ELSE T2.SCRAP_NUM END ),T1.QUALIFIED_NUM= (CASE T2.QUALIFIED_NUM WHEN null THEN 0 ELSE T2.QUALIFIED_NUM END ),T1.REINSPECTION_NUM=(CASE T2.REINSPECTION_NUM WHEN null THEN 0 ELSE T2.REINSPECTION_NUM END )"
				+ ",T1.REINSPECTION_QUALIFIED_NUM=(CASE T2.REINSPECTION_QUALIFIED_NUM WHEN null THEN 0 ELSE T2.REINSPECTION_QUALIFIED_NUM END),T1.DETECTION_NUM=(CASE T2.DETECTION_NUM  WHEN null THEN 0 ELSE T2.DETECTION_NUM END )";
		if (TestMethod.contains("漏磁")) {
			sql += ",T1.ALARM_NUM=(CASE  T2.SUSPECT_PRODUCT_NUM WHEN null THEN 0 ELSE T2.SUSPECT_PRODUCT_NUM  END ),T1.RECUT_NUM=(CASE T2.RECUT_NUM WHEN null THEN 0 ELSE T2.RECUT_NUM END) ";
		} else {
			sql += ",T1.SUSPECT_PRODUCT_NUM=(CASE T2.SUSPECT_PRODUCT_NUM WHEN null THEN 0 ELSE T2.SUSPECT_PRODUCT_NUM END ),T1.RECUT_NUM=(CASE T2.RECUT_NUM WHEN null THEN 0 ELSE T2.RECUT_NUM END) ";
		}
		if (TestMethod.contains("涡流"))// ET)
		{
			sql += " ,T1.SCRAP_NUM3=(CASE T2.SCRAP_NUM3 WHEN null THEN 0 ELSE T2.SCRAP_NUM3 END ),T1.QUALIFIED_NUM3=(CASE T2.QUALIFIED_NUM3 WHEN null THEN 0 ELSE  T2.QUALIFIED_NUM3 END ) ,T1.REINSPECTION_NUM3=(CASE T2.REINSPECTION_NUM3 WHEN null THEN 0 ELSE T2.REINSPECTION_NUM3 END)"
					+ ",T1.REINSPECTION_QUALIFIED_NUM3=( CASE T2.REINSPECTION_QUALIFIED_NUM3 WHEN null THEN 0 ELSE T2.REINSPECTION_QUALIFIED_NUM3 END ),T1.DETECTION_NUM3=(CASE T2.DETECTION_NUM3 WHEN null THEN 0 ELSE T2.DETECTION_NUM3 END)"
					+ ",T1.SUSPECT_PRODUCT_NUM3= (CASE T2.SUSPECT_PRODUCT_NUM3 WHEN null THEN 0 ELSE T2.SUSPECT_PRODUCT_NUM3 END )"
					+ ",T1.RECUT_NUM3=(CASE T2.RECUT_NUM3 WHEN null THEN 0 ELSE T2.RECUT_NUM3 END )";
		}
		sqllist.add(sql);

		// -------修改管号队列
		String sql7 = "UPDATE MIL_TESTING_RACK T SET T.STATUS=0,T.ALARM_REASON='',T.SCRAP_REASON='',T.COL_USER='',"
				+ "T.COL_SHIFT='',T.COL_GROUP='',T.COL_NO='',T.SUSPECT_FLAG=0,T.RECUT_FLAG= 0,T.RECUT_LENGTH='',T.SCRAP_TIME='', T.RETEST_NUM=0";
		sql7 += " WHERE T.JUDGE_STOVE_NO='" + detail.getJudgeStoveNo()
				+ "' AND T.PLINE_CODE='" + detail.getPlineCode()
				+ "' AND T.COL_USER='" + detail.getColUser()
				+ "' AND T.COL_SHIFT= " + detail.getColShift()

				+ " AND T.COL_GROUP=" + detail.getColGroup() + " AND T.COL_NO="
				+ detail.getColNo();
		sqllist.add(sql7);
		String sql8 = " UPDATE MIL_TESTING_RACK T SET T.COL_NO="
				+ detail.getColNo() + " ,  T.COL_USER='" + detail.getColUser()
				+ "' , T.COL_SHIFT= " + detail.getColShift() + ", T.COL_GROUP="
				+ detail.getColGroup() + ",T.END_INSPECTION_TIME=SYSDATE  ";
		sql8 += " WHERE T.JUDGE_STOVE_NO='"
				+ detail.getJudgeStoveNo()
				+ "' AND T.PLINE_CODE='"
				+ detail.getPlineCode()
				+ "' AND T.SEQ IN(select SEQ "
				+ "from (select a.SEQ AS SEQ from MIL_TESTING_RACK a WHERE a.JUDGE_STOVE_NO='"
				+ detail.getJudgeStoveNo()
				+ "' AND a.PLINE_CODE='"
				+ detail.getPlineCode()

				+ "' "
				+ "AND a.STATUS=0 AND (a.ALARM_REASON='' OR a.ALARM_REASON is null)  AND (a.SCRAP_REASON='' OR a.SCRAP_REASON is null) AND (a.COL_USER='' OR a.COL_USER is null ) "
				+ "AND (a.COL_SHIFT='' OR a.COL_SHIFT is null ) AND (a.COL_GROUP='' OR a.COL_GROUP is null ) AND (a.COL_NO='' OR a.COL_NO is null) AND a.SUSPECT_FLAG=0 AND a.RECUT_FLAG=0  AND (a.RECUT_LENGTH='' OR a.RECUT_LENGTH is null ) order by a.seq ) WHERE rownum between 1 and ";
		if (detail.getColNo().equals("1")) {
			sql8 += detail.getDetectionNum1() + " )";
		}
		if (detail.getColNo().equals("2")) {
			sql8 += detail.getDetectionNum2() + " )";
		}
		if (detail.getColNo().equals("3")) {
			sql8 += detail.getDetectionNum3() + " )";
		}
		sqllist.add(sql8);// 分队列

		String sql9 = " UPDATE MIL_TESTING_RACK T SET T.SUSPECT_FLAG= 1 ";
		sql9 += " WHERE T.JUDGE_STOVE_NO='"
				+ detail.getJudgeStoveNo()
				+ "' AND T.PLINE_CODE='"
				+ detail.getPlineCode()
				+ "' AND T.SEQ IN(select SEQ "
				+ "from (select a.SEQ AS SEQ from MIL_TESTING_RACK a WHERE a.JUDGE_STOVE_NO='"
				+ detail.getJudgeStoveNo() + "' AND a.PLINE_CODE='"
				+ detail.getPlineCode() + "' AND a.COL_USER='"
				+ detail.getColUser() + "' AND a.COL_SHIFT= "
				+ detail.getColShift() + " AND a.COL_GROUP="
				+ detail.getColGroup() + " AND a.COL_NO=" + detail.getColNo()

				+ "  order by a.seq ) WHERE rownum between 1 and ";
		if (detail.getColNo().equals("1")) {
			sql9 += detail.getSuspectProductNum1() + " )";
		}
		if (detail.getColNo().equals("2")) {
			sql9 += detail.getSuspectProductNum2() + " )";
		}
		if (detail.getColNo().equals("3")) {
			sql9 += detail.getSuspectProductNum3() + " )";
		}
		sqllist.add(sql9);// 可疑品

		for (int i = 0; i < listdes1.size(); i++) {
			MilTestingResultDetailDesEntity des = new MilTestingResultDetailDesEntity();
			des = listdes1.get(i);
			String sqltemp = " UPDATE MIL_TESTING_RACK T SET T.ALARM_REASON =(CASE '"
					+ des.getReason()
					+ "' WHEN 'LOD' THEN '1' WHEN 'LID' THEN '2' WHEN 'TOD' THEN '3' ELSE '4' END )";
			sqltemp += " WHERE T.JUDGE_STOVE_NO='"
					+ detail.getJudgeStoveNo()
					+ "' AND T.PLINE_CODE='"
					+ detail.getPlineCode()
					+ "' AND T.SEQ IN(select SEQ "
					+ "from (select a.SEQ AS SEQ from MIL_TESTING_RACK a WHERE a.JUDGE_STOVE_NO='"
					+ detail.getJudgeStoveNo()
					+ "' AND a.PLINE_CODE='"
					+ detail.getPlineCode()
					+ "' AND a.COL_USER='"
					+ detail.getColUser()
					+ "' AND a.COL_SHIFT= "
					+ detail.getColShift()
					+ " AND a.COL_GROUP="
					+ detail.getColGroup()
					+ " AND a.COL_NO="
					+ detail.getColNo()

					+ " AND a.SUSPECT_FLAG=1 AND (a.ALARM_REASON is null OR a.ALARM_REASON='' ) order by a.seq ) WHERE rownum between 1 and ";
			sqltemp += des.getReasonNumber() + " )";
			sqllist.add(sqltemp);
		}

		String sql10 = " UPDATE MIL_TESTING_RACK T SET T.STATUS='1',T.SCRAP_TIME=SYSDATE   ";// 剔除
		sql10 += " WHERE T.JUDGE_STOVE_NO='"
				+ detail.getJudgeStoveNo()
				+ "' AND T.PLINE_CODE='"
				+ detail.getPlineCode()
				+ "' AND T.SEQ IN(select SEQ "
				+ "from (select a.SEQ AS SEQ from MIL_TESTING_RACK a WHERE a.JUDGE_STOVE_NO='"
				+ detail.getJudgeStoveNo()
				+ "' AND a.PLINE_CODE='"
				+ detail.getPlineCode()
				+ "' AND a.COL_USER='"
				+ detail.getColUser()
				+ "' AND a.COL_SHIFT= "
				+ detail.getColShift()
				+ "AND a.COL_GROUP="
				+ detail.getColGroup()
				+ " AND a.COL_NO="
				+ detail.getColNo()

				+ " AND a.SUSPECT_FLAG=1  order by a.seq ) WHERE rownum between 1 and ";
		if (detail.getColNo().equals("1")) {
			sql10 += detail.getScrapNum1() + " )";
		}
		if (detail.getColNo().equals("2")) {
			sql10 += detail.getScrapNum2() + " )";
		}
		if (detail.getColNo().equals("3")) {
			sql10 += detail.getScrapNum3() + " )";
		}
		sqllist.add(sql10);// 剔除
		for (int i = 0; i < listdes2.size(); i++) {
			MilTestingResultDetailDesEntity des = new MilTestingResultDetailDesEntity();
			des = listdes2.get(i);
			String sqltemp = " UPDATE MIL_TESTING_RACK T SET T.SCRAP_REASON='"
					+ des.getReason() + "'";
			sqltemp += " WHERE T.JUDGE_STOVE_NO='"
					+ detail.getJudgeStoveNo()
					+ "' AND T.PLINE_CODE='"
					+ detail.getPlineCode()
					+ "' AND T.SEQ IN(select SEQ "
					+ "from (select a.SEQ AS SEQ from MIL_TESTING_RACK a WHERE a.JUDGE_STOVE_NO='"
					+ detail.getJudgeStoveNo()
					+ "' AND a.PLINE_CODE='"
					+ detail.getPlineCode()
					+ "' AND a.COL_USER='"
					+ detail.getColUser()
					+ "' AND a.COL_SHIFT= "
					+ detail.getColShift()
					+ "AND a.COL_GROUP="
					+ detail.getColGroup()
					+ " AND a.COL_NO="
					+ detail.getColNo()

					+ " AND a.STATUS='1' AND a.SCRAP_REASON is null  order by a.seq ) WHERE rownum between 1 and ";
			sqltemp += des.getReasonNumber() + " )";
			sqllist.add(sqltemp);
		}
		int num1 = 0;// 复探剔除的
		int num2 = 0;// 复探合格的
		if (detail.getColNo().equals("1")) {
			num1 = Integer.parseInt(detail.getReinspectionNum1())
					- Integer.parseInt(detail.getReinspectionQualifiedNum1());
			num2 = Integer.parseInt(detail.getReinspectionQualifiedNum1());
		}
		if (detail.getColNo().equals("2")) {
			num1 = Integer.parseInt(detail.getReinspectionNum2())
					- Integer.parseInt(detail.getReinspectionQualifiedNum2());
			num2 = Integer.parseInt(detail.getReinspectionQualifiedNum2());
		}
		if (detail.getColNo().equals("3")) {
			num1 = Integer.parseInt(detail.getReinspectionNum3())
					- Integer.parseInt(detail.getReinspectionQualifiedNum3());
			num2 = Integer.parseInt(detail.getReinspectionQualifiedNum3());
		}
		if (num1 > 0) {
			String sqltemp1 = " UPDATE MIL_TESTING_RACK T SET T.RETEST_NUM=1 ";
			sqltemp1 += " WHERE T.JUDGE_STOVE_NO='"
					+ detail.getJudgeStoveNo()
					+ "' AND T.PLINE_CODE='"
					+ detail.getPlineCode()
					+ "' AND T.SEQ IN(select SEQ "
					+ "from (select a.SEQ AS SEQ from MIL_TESTING_RACK a WHERE a.JUDGE_STOVE_NO='"
					+ detail.getJudgeStoveNo()
					+ "' AND a.PLINE_CODE='"
					+ detail.getPlineCode()
					+ "' AND a.COL_USER='"
					+ detail.getColUser()
					+ "' AND a.COL_SHIFT= "
					+ detail.getColShift()
					+ "AND a.COL_GROUP="
					+ detail.getColGroup()
					+ " AND a.COL_NO="
					+ detail.getColNo()

					+ " AND a.STATUS='1' AND a.SCRAP_REASON is not null  order by a.seq ) WHERE rownum between 1 and "
					+ num1 + " )";
			sqllist.add(sqltemp1);
		}
		if (num2 > 0) {
			String sqltemp2 = " UPDATE MIL_TESTING_RACK T SET T.RETEST_NUM=1 ,T.STATUS=2 ";
			sqltemp2 += " WHERE T.JUDGE_STOVE_NO='"
					+ detail.getJudgeStoveNo()
					+ "' AND T.PLINE_CODE='"
					+ detail.getPlineCode()
					+ "' AND T.SEQ IN(select SEQ "
					+ "from (select a.SEQ AS SEQ from MIL_TESTING_RACK a WHERE a.JUDGE_STOVE_NO='"
					+ detail.getJudgeStoveNo()
					+ "' AND a.PLINE_CODE='"
					+ detail.getPlineCode()
					+ "' AND a.COL_USER='"
					+ detail.getColUser()
					+ "' AND a.COL_SHIFT= "
					+ detail.getColShift()
					+ "AND a.COL_GROUP="
					+ detail.getColGroup()
					+ " AND a.COL_NO="
					+ detail.getColNo()

					+ " AND a.SUSPECT_FLAG='1' AND a.STATUS = 0  order by a.seq ) WHERE rownum between 1 and ";
			sqltemp2 += num2 + " )";
			sqllist.add(sqltemp2);
		}
		if (!detail.getPlineCode().equals("C010"))// 168无子管再切
		{
			int num = 0;
			if (detail.getColNo().equals("1")) {
				num = Integer.parseInt(detail.getRecutNum1());
			}
			if (detail.getColNo().equals("2")) {
				num = Integer.parseInt(detail.getRecutNum2());
			}
			if (detail.getColNo().equals("3")) {
				num = Integer.parseInt(detail.getRecutNum3());
			}
			String sqltemp = " UPDATE MIL_TESTING_RACK T SET T.RECUT_FLAG = 1  ";
			sqltemp += " WHERE T.JUDGE_STOVE_NO='"
					+ detail.getJudgeStoveNo()
					+ "' AND T.PLINE_CODE='"
					+ detail.getPlineCode()
					+ "' AND T.SEQ IN(select SEQ "
					+ "from (select a.SEQ AS SEQ from MIL_TESTING_RACK a WHERE a.JUDGE_STOVE_NO='"
					+ detail.getJudgeStoveNo()
					+ "' AND a.PLINE_CODE='"
					+ detail.getPlineCode()
					+ "' AND a.COL_USER='"
					+ detail.getColUser()
					+ "' AND a.COL_SHIFT= "
					+ detail.getColShift()
					+ "AND a.COL_GROUP="
					+ detail.getColGroup()
					+ " AND a.COL_NO="
					+ detail.getColNo()

					+ " AND a.SUSPECT_FLAG='1' AND a.STATUS <> 1 order by a.seq ) WHERE rownum between 1 and ";
			sqltemp += num + " )";
			sqllist.add(sqltemp);
		}
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);

	}

	/***
	 * 探伤实绩保存
	 * 
	 * @param arr
	 * @param TestMethod
	 * @return
	 */
	public CoreReturnObject insertTestResultDetail(ArrayList arr,
			String TestMethod) {
		CoreReturnObject cro = new CoreReturnObject();
		Connection connection = this.getDao(CoreConstantData.sysbeanstr)
				.getConnection();
		Date now = new Date();
		SimpleDateFormat dateFormat = new SimpleDateFormat(
				"yyyy-MM-dd HH:mm:ss");
		SimpleDateFormat df = new SimpleDateFormat("yyyyMM");
		String systime = dateFormat.format(now);
		String yearMoth = df.format(now);
		try {
			connection.setAutoCommit(false); // 取消自动提交事务
			String insertResultSql = CoreXmlSqlParsersFactory.getSql("");// 插入实绩
			PreparedStatement insertResultPsta = connection
					.prepareStatement(insertResultSql);
			String updateResultSql = CoreXmlSqlParsersFactory.getSql("");// 修改实绩
			PreparedStatement updateResultPsta = connection
					.prepareStatement(updateResultSql);
			ArrayList<MilTestingResultDetailDesEntity> listdes1 = (ArrayList<MilTestingResultDetailDesEntity>) arr
					.get(1);
			ArrayList<MilTestingResultDetailDesEntity> listdes2 = (ArrayList<MilTestingResultDetailDesEntity>) arr
					.get(2);
			MilTestingResultDetailEntity detail = (MilTestingResultDetailEntity) arr
					.get(0);

			if (!isinsertdetail(detail))// 新增
			{
				if (detail.getColNo().equals("1")) {

				}
			} else // 修改
			{

			}

		} catch (SQLException e) {
			System.out.println(e.getMessage());
			if (connection != null) {
				try {
					connection.rollback(); // 回滚事务
				} catch (Exception e2) {
				}
			}
		} finally {
			try {
				if (connection != null && !connection.isClosed()) {
					connection.close();
				}
			} catch (Exception e2) {
			}
		}
		return cro;
	}

	public boolean isinsertdetail(MilTestingResultDetailEntity detail) {
		Connection conn = null;
		PreparedStatement psta = null;
		ResultSet re = null;
		String sql = "Select * From MIL_TESTING_RESULT_DETAIL WHERE JUDGE_STOVE_NO='"
				+ detail.getJudgeStoveNo()
				+ "' AND  PLINE_CODE='"
				+ detail.getPlineCode() + "'";
		sql += " AND COL_SHIFT='" + detail.getColShift() + "' AND  COL_GROUP='"
				+ detail.getColGroup() + "'";
		boolean result = false;
		try {
			conn = this.getDao("TgDao").getConnection();
			conn.setAutoCommit(false);
			psta = conn.prepareStatement(sql);
			re = psta.executeQuery();
			while (re.next()) {
				result = true;
			}
		} catch (SQLException sqle) {
			sqle.printStackTrace();
			try {
				conn.rollback();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		} finally {
			try {
				if (conn != null && !conn.isClosed()) {
					conn.close();
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return result;
	}

	public CoreReturnObject GetResultDetail(String str, String plincode,
			String ColGroup, String ColUser, String ColShift, String proPlanId,
			String gxPlanNo) {
		String sql = "SELECT * FROM　MIL_TESTING_RESULT_DETAIL　T 　";
		sql += " WHERE　T.JUDGE_STOVE_NO='" + str
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')" + " AND PLINE_CODE='" + plincode
				+ "' AND COL_SHIFT=" + ColShift + " AND COL_GROUP=" + ColGroup;
		return this.getData(sql);
	}

	public CoreReturnObject GetResultDetaildes(String str, String plincode,
			String ColGroup, String ColShift, String proPlanId, String gxPlanNo) {
		String sql = "SELECT * FROM　MIL_TESTING_RESULT_DETAIL_DES　T ";
		sql += " WHERE　T.JUDGE_STOVE_NO='" + str
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')" + " AND PLINE_CODE='" + plincode
				+ "' AND COL_SHIFT=" + ColShift + " AND COL_GROUP=" + ColGroup;
		return this.getData(sql);
	}

	public CoreReturnObject startbackcheck(String JudgeStoveNo,
			String plincode, String ColGroup, String ColShift,
			String proPlanId, String gxPlanNo) {
		String sql = "SELECT * FROM　MIL_TESTING_RESULT_DETAIL　T ";
		sql += " WHERE　T.JUDGE_STOVE_NO='" + JudgeStoveNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')" + "  AND PLINE_CODE='" + plincode
				+ "' AND COL_SHIFT <> " + ColShift + " AND COL_GROUP <>"
				+ ColGroup;
		return this.getData(sql);
	}

	public CoreReturnObject TeststartBack(String JudgeStoveNo, String ResultNo,
			String plincode, String ColGroup, String ColShift,
			String proPlanId, String gxPlanNo) {
		ArrayList<String> sqllist = new ArrayList<String>();
		String sql1 = "update MIL_PLAN set STATUS = '75'  where JUDGE_STOVE_NO = '"
				+ JudgeStoveNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
				+ proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
				+ gxPlanNo + "','/')" + "  AND ID = '" + ResultNo + "'";
		String TableName = "";
		if (plincode.equals("C008") || plincode.equals("C009")
				|| plincode.equals("C017") || plincode.equals("C072")) {
			TableName = "MIL_MT_RESULT";
		} else if (plincode.equals("C010")) {
			TableName = "MIL_ET_RESULT";
		} else {
			TableName = "MIL_UL_RESUL";
		}
		String sql2 = "delete from  " + TableName
				+ "  where JUDGE_STOVE_NO = '" + JudgeStoveNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
				+ "','/')" + "  AND RESULT_NO = '" + ResultNo + "'";
		String sql3 = "UPDATE MIL_TESTING_RACK T SET T.STATUS=0,T.ALARM_REASON='',T.SCRAP_REASON='',T.COL_USER='',"
				+ "T.COL_SHIFT='',T.COL_GROUP='',T.COL_NO='',T.SUSPECT_FLAG=0,T.RECUT_FLAG=0,T.RECUT_LENGTH='',T.RETEST_NUM = '0',T.CHANGE_FLAG = '0',T.OFFLINE_FLAG= '0',T.OFFLINE_TYPE = '0',T.OFFLINE_REASON = '',T.SAMPLE_FLAG = '0',T.OFFLINE_TIME = ''"
				+ " where JUDGE_STOVE_NO = '"
				+ JudgeStoveNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
				+ proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
				+ gxPlanNo
				+ "','/')" + "  AND RESULT_NO = '" + ResultNo + "'";
		String sql4 = "delete MIL_SLAB_SCRAP_SEQ where JUDGE_STOVE_NO = '"
				+ JudgeStoveNo + "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
				+ proPlanId + "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
				+ gxPlanNo + "','/')" + " and PROCESS_NO ='10' ";

		String sql5 = "delete from  MIL_TESTING_RESULT_DETAIL where JUDGE_STOVE_NO = '"
				+ JudgeStoveNo
				+ "' AND RESULT_NO = '"
				+ ResultNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
				+ proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
				+ gxPlanNo
				+ "','/')";
		String sql6 = "delete from  MIL_TESTING_RESULT_DETAIL_DES where JUDGE_STOVE_NO = '"
				+ JudgeStoveNo
				+ "' AND RESULT_NO = '"
				+ ResultNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
				+ proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
				+ gxPlanNo
				+ "','/')";
		String sql7 = "UPDATE PORT_MIL_BATCH_SAMPLE_RESULT T SET T.STATUS = '0',T.OP_PROCESS = '' WHERE T.STATUS = '2' AND T.OP_PROCESS = '10' AND T.JUDGE_STOVE_NO = '"
				+ JudgeStoveNo
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
				+ proPlanId
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
				+ gxPlanNo + "','/')";
		String sql8 = "DELETE FROM MAT_BC_M T WHERE T.BATCH_NO = 'F' AND T.PROCESS_CDOE = 'D' AND T.ZG_STOVE_SQE = '"
				+ JudgeStoveNo + "' ";
		sqllist.add(sql1);
		sqllist.add(sql2);
		sqllist.add(sql3);
		sqllist.add(sql4);
		sqllist.add(sql5);
		sqllist.add(sql6);
		sqllist.add(sql7);
		sqllist.add(sql8);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);

	}

	public CoreReturnObject NodeCheckNum(String heatno, String resultno,
			String testmethod) {
		String sql = " SELECT * FROM ";
		if (testmethod.contains("涡流")) {
			sql += " MIL_ET_RESULT T ";
		}
		if (testmethod.contains("漏磁")) {
			sql += " MIL_MT_RESULT T ";
		}
		if (testmethod.contains("超声波")) {
			sql += " MIL_UL_RESUL T ";
		}
		sql += " WHERE　JUDGE_STOVE_NO='" + heatno + "' AND RESULT_NO='"
				+ resultno + "'";
		return this.getData(sql);
	}

	/**
	 * 2、更新ET实绩表（包括结炉时间） 3.更新主表NODE_STATUS
	 */
	public CoreReturnObject UpdateETResultNodeNEW(
			com.steering.mes.zgmil.entity.MilEtResultEntity milet, String Colno) {
		ArrayList<String> arr = new ArrayList<String>();
		String sql = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdatETResult");
		String sqlnum = "UPDATE MIL_ET_RESULT SET NODE_FUR_FLAG = '1',END_TIME = sysdate";
		// if (Colno.equals("1")) {
		// sqlnum += " NODE_FUR_FLAG1='1' ";
		// }
		// if (Colno.equals("2")) {
		// sqlnum += " NODE_FUR_FLAG2='1' ";
		// }
		// if (Colno.equals("3")) {
		// sqlnum += " NODE_FUR_FLAG3='1' ";
		// }
		sqlnum += " WHERE JUDGE_STOVE_NO='" + milet.getJudgeStoveNo()
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + milet.getProPlanId()
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
				+ milet.getGxPlanNo() + "','/')";
		String sql3 = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdateETResultShift");
		String sql4 = "  UPDATE MIL_ET_RESULT T SET  QA_TON="
				+ milet.getQaTon();
		sql4 += " WHERE JUDGE_STOVE_NO='" + milet.getJudgeStoveNo()
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + milet.getProPlanId()
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
				+ milet.getGxPlanNo() + "','/')";
		String sql5 = "UPDATE MIL_PLAN SET NODE_STATUS = '90' WHERE JUDGE_STOVE_NO='"
				+ milet.getJudgeStoveNo()
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
				+ milet.getProPlanId()
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
				+ milet.getGxPlanNo() + "','/')";
		String sql6 = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdtaeRackShift");
		// 更新进程表mil_processes数据
		String updateProcess = CoreXmlSqlParsersFactory
				.getSql("FrmInOnlineStore.insertMilProcess2");
		sql3 = EntityTool.fillSqlByEntity(sql3, milet);
		sql = EntityTool.fillSqlByEntity(sql, milet);
		sql6 = EntityTool.fillSqlByEntity(sql6, milet);
		updateProcess = EntityTool.fillSqlByEntity(updateProcess, milet);
		arr.add(sql);
		arr.add(sqlnum);
		arr.add(sql3);
		arr.add(sql4);
		arr.add(sql5);
		arr.add(sql6);
		arr.add(updateProcess);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(arr);

	}

	/**
	 * 更新MT实绩，更新主表结炉状态
	 */
	public CoreReturnObject UpdateMTResultNodeNEW(
			com.steering.mes.zgmil.entity.MilMtResultEntity milmt, String colno) {
		ArrayList<String> arr = new ArrayList<String>();

		String sql = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdatMTResult");
		String sqlnum = " UPDATE MIL_MT_RESULT SET NODE_FUR_FLAG = '1',END_TIME = sysdate";
		// if (colno.equals("1")) {
		// sqlnum += " NODE_FUR_FLAG1='1' ";
		// }
		// if (colno.equals("2")) {
		// sqlnum += " NODE_FUR_FLAG2='1' ";
		// }
		sqlnum += " WHERE JUDGE_STOVE_NO='" + milmt.getJudgeStoveNo()
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + milmt.getProPlanId()
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
				+ milmt.getGxPlanNo() + "','/')";
		String sql3 = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdateMTResultShift");
		String sql4 = "  UPDATE MIL_MT_RESULT T SET  QA_TON="
				+ milmt.getQaTon();
		sql4 += " WHERE JUDGE_STOVE_NO='" + milmt.getJudgeStoveNo()
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + milmt.getProPlanId()
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
				+ milmt.getGxPlanNo() + "','/')";
		String sql5 = "UPDATE MIL_PLAN SET NODE_STATUS = '90' WHERE JUDGE_STOVE_NO='"
				+ milmt.getJudgeStoveNo()
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
				+ milmt.getProPlanId()
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
				+ milmt.getGxPlanNo() + "','/')";
		// 修改Rack表下线管
		String sql6 = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdtaeRackShift");
		// 更新进程表mil_processes数据
		String updateProcess = CoreXmlSqlParsersFactory
				.getSql("FrmInOnlineStore.insertMilProcess2");
		sql3 = EntityTool.fillSqlByEntity(sql3, milmt);
		sql = EntityTool.fillSqlByEntity(sql, milmt);
		sql6 = EntityTool.fillSqlByEntity(sql6, milmt);
		updateProcess = EntityTool.fillSqlByEntity(updateProcess, milmt);
		arr.add(sql);
		arr.add(sqlnum);
		arr.add(sql3);
		arr.add(sql4);
		arr.add(sql5);
		arr.add(sql6);
		arr.add(updateProcess);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(arr);
	}

	/**
	 * 更新UT探伤实绩，更新主表状态
	 */
	public CoreReturnObject UpdateUTResultNodeNEW(
			com.steering.mes.zgmil.entity.MilUlResulEntity milul, String colno) {
		ArrayList<String> arr = new ArrayList<String>();
		String sql = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdatUTResult");
		String sqlnum = " UPDATE MIL_UL_RESUL SET ";
		if (colno.equals("1")) {
			sqlnum += "NODE_FUR_FLAG1='1' ";
		}
		if (colno.equals("2")) {
			sqlnum += "NODE_FUR_FLAG2='1' ";
		}
		sqlnum += " WHERE JUDGE_STOVE_NO='" + milul.getJudgeStoveNo()
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + milul.getProPlanId()
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
				+ milul.getGxPlanNo() + "','/')";
		String sql3 = CoreXmlSqlParsersFactory
				.getSql("FrmEddyCurrentTestingResult.UpdateUTResultShift");
		String sql4 = "  UPDATE MIL_UL_RESUL T SET  QA_TON=" + milul.getQaTon();
		sql4 += " WHERE JUDGE_STOVE_NO='" + milul.getJudgeStoveNo()
				+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + milul.getProPlanId()
				+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
				+ milul.getGxPlanNo() + "','/')";
		sql3 = EntityTool.fillSqlByEntity(sql3, milul);
		sql = EntityTool.fillSqlByEntity(sql, milul);
		arr.add(sql);
		arr.add(sqlnum);
		arr.add(sql3);
		arr.add(sql4);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(arr);

	}

	public boolean isdellresultdetail(String JudgeStoveNo, String plincode,
			String Group, String Shift, String COLNO) {
		Connection conn = null;
		PreparedStatement psta = null;
		ResultSet re = null;
		String sql = "SELECT * FROM MIL_TESTING_RACK WHERE JUDGE_STOVE_NO='"
				+ JudgeStoveNo + "' AND  PLINE_CODE='" + plincode + "'";
		sql += " AND COL_SHIFT='" + Shift + "' AND  COL_GROUP='" + Group + "'";
		sql += " AND COL_NO<> " + COLNO;
		boolean result = false;
		try {
			conn = this.getDao("TgDao").getConnection();
			conn.setAutoCommit(false);
			psta = conn.prepareStatement(sql);
			re = psta.executeQuery();
			while (re.next()) {
				result = true;
			}
		} catch (SQLException sqle) {
			sqle.printStackTrace();
			try {
				conn.rollback();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		} finally {
			try {
				if (conn != null && !conn.isClosed()) {
					conn.close();
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return result;
	}

	public CoreReturnObject InsetTestResultdetailBack(String JudgeStoveNo,
			String plincode, String TestMethod, String ResultNo, String Group,
			String Shift, String COLNO, String flag, String backType,
			String bProcessNo, String proPlanId, String gxPlanNo, String lotNo) {
		ArrayList<String> sqllist = new ArrayList<String>();
		if (backType.equals("1")) {
			if (flag.equals("0")) {
				String sql1 = " DELETE FROM MIL_TESTING_RESULT_DETAIL ";
				sql1 += " WHERE JUDGE_STOVE_NO='" + JudgeStoveNo
						+ "' AND PLINE_CODE='" + plincode + "'";
				sql1 += " AND  COL_SHIFT='" + Shift + "' AND COL_GROUP='"
						+ Group + "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
						+ proPlanId + "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
						+ gxPlanNo + "','/')";
				sqllist.add(sql1);
			} else {
				if (isdellresultdetail(JudgeStoveNo, plincode, Group, Shift,
						COLNO)) {
					String sql1 = "UPDATE MIL_TESTING_RESULT_DETAIL SET ";
					if (COLNO.equals("1")) {
						sql1 += " SCRAP_NUM1=0, QUALIFIED_NUM1=0 ,REINSPECTION_NUM1=0 ,REINSPECTION_QUALIFIED_NUM1=0, DETECTION_NUM1=0 ,SUSPECT_PRODUCT_NUM1=0";
						sql1 += " ,RECUT_NUM1=0 , SCRAP_NUM=SCRAP_NUM2+SCRAP_NUM3 , QUALIFIED_NUM=QUALIFIED_NUM3+QUALIFIED_NUM2  ,REINSPECTION_NUM=REINSPECTION_NUM2+REINSPECTION_NUM3";
						sql1 += " ,REINSPECTION_QUALIFIED_NUM=REINSPECTION_QUALIFIED_NUM2+REINSPECTION_QUALIFIED_NUM3 , DETECTION_NUM=DETECTION_NUM2+DETECTION_NUM3"
								+ " ,SUSPECT_PRODUCT_NUM=SUSPECT_PRODUCT_NUM2+SUSPECT_PRODUCT_NUM3";
						sql1 += " ,RECUT_NUM=RECUT_NUM2+RECUT_NUM3";
					}
					if (COLNO.equals("2")) {
						sql1 += " SCRAP_NUM2=0 , QUALIFIED_NUM2=0 ,REINSPECTION_NUM2=0 ,REINSPECTION_QUALIFIED_NUM2="
								+ "0 , DETECTION_NUM2= 0 , SUSPECT_PRODUCT_NUM2=0";
						sql1 += " ,RECUT_NUM2=0  , SCRAP_NUM=SCRAP_NUM1+SCRAP_NUM3 , QUALIFIED_NUM=QUALIFIED_NUM3+QUALIFIED_NUM1, REINSPECTION_NUM=REINSPECTION_NUM1+REINSPECTION_NUM3 ";
						sql1 += " ,REINSPECTION_QUALIFIED_NUM=REINSPECTION_QUALIFIED_NUM1+REINSPECTION_QUALIFIED_NUM3 "
								+ " , DETECTION_NUM=DETECTION_NUM1+DETECTION_NUM3 "
								+ " ,SUSPECT_PRODUCT_NUM=SUSPECT_PRODUCT_NUM1+SUSPECT_PRODUCT_NUM3 ";
						sql1 += " ,RECUT_NUM=RECUT_NUM1+RECUT_NUM3 ";
					}
					if (COLNO.equals("3")) {
						sql1 += " SCRAP_NUM3=0, QUALIFIED_NUM3=0 ,REINSPECTION_NUM3=0 ,REINSPECTION_QUALIFIED_NUM3= 0 "
								+ ", DETECTION_NUM3= 0  ,SUSPECT_PRODUCT_NUM3=0 ";
						sql1 += " ,RECUT_NUM3=0 ,SCRAP_NUM=SCRAP_NUM1+SCRAP_NUM2  , QUALIFIED_NUM=QUALIFIED_NUM2+QUALIFIED_NUM1  ,REINSPECTION_NUM=REINSPECTION_NUM1+REINSPECTION_NUM2";
						sql1 += " ,REINSPECTION_QUALIFIED_NUM=REINSPECTION_QUALIFIED_NUM1+REINSPECTION_QUALIFIED_NUM2 , DETECTION_NUM=DETECTION_NUM1+DETECTION_NUM2"
								+ " ,SUSPECT_PRODUCT_NUM=SUSPECT_PRODUCT_NUM1+SUSPECT_PRODUCT_NUM2";
						sql1 += " ,RECUT_NUM=RECUT_NUM1+RECUT_NUM2";
					}
					sql1 += " WHERE JUDGE_STOVE_NO='" + JudgeStoveNo
							+ "' AND PLINE_CODE='" + plincode + "'";
					sql1 += " AND  COL_SHIFT='" + Shift + "' AND COL_GROUP='"
							+ Group + "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
							+ proPlanId
							+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
							+ gxPlanNo + "','/')";
					sqllist.add(sql1);

				} else {
					String sql1 = " DELETE FROM MIL_TESTING_RESULT_DETAIL ";
					sql1 += " WHERE JUDGE_STOVE_NO='" + JudgeStoveNo
							+ "' AND PLINE_CODE='" + plincode + "'";
					sql1 += " AND  COL_SHIFT='" + Shift + "' AND COL_GROUP='"
							+ Group + "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
							+ proPlanId
							+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
							+ gxPlanNo + "','/')";
					sqllist.add(sql1);
				}
			}
			String sql2 = " DELETE FROM MIL_TESTING_RESULT_DETAIL_DES ";
			sql2 += "WHERE JUDGE_STOVE_NO='" + JudgeStoveNo
					+ "' AND PLINE_CODE='" + plincode + "'";
			sql2 += " AND  COL_SHIFT='" + Shift + "' AND  COL_GROUP='" + Group
					+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
					+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
					+ "','/')";
			if (!flag.equals("0")) {
				sql2 += " AND COL_NO='" + COLNO + "'";
			}
			sqllist.add(sql2);

			String sql7 = "UPDATE MIL_TESTING_RACK T SET T.STATUS=0,T.ALARM_REASON='',T.SCRAP_REASON='',T.COL_USER='',"
					+ "T.COL_SHIFT='',T.COL_GROUP='',T.COL_NO='',T.SUSPECT_FLAG=0,T.RECUT_FLAG= 0,T.RECUT_LENGTH='',T.SCRAP_TIME='', T.RETEST_NUM=0,T.OFFLINE_TIME = ''";
			sql7 += " WHERE T.JUDGE_STOVE_NO='" + JudgeStoveNo
					+ "' AND T.PLINE_CODE='" + plincode
					+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
					+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
					+ "','/')" + " AND T.COL_SHIFT= " + Shift
					+ " AND T.COL_GROUP=" + Group;
			if (!flag.equals("0")) {
				sql7 += " AND COL_NO=" + COLNO;
			}
			sqllist.add(sql7);

			// //---------更新实绩
			String sql5 = "SELECT SUM(SCRAP_NUM1) AS  SCRAP_NUM1,SUM(QUALIFIED_NUM1) AS  QUALIFIED_NUM1,SUM(REINSPECTION_NUM1) AS  REINSPECTION_NUM1"
					+ ",SUM(REINSPECTION_QUALIFIED_NUM1) AS  REINSPECTION_QUALIFIED_NUM1,SUM(OFFLINE_NUM1) AS  OFFLINE_NUM1,SUM(BACKLINE_NUM1) AS  BACKLINE_NUM1"
					+ ",SUM(DETECTION_NUM1) AS DETECTION_NUM1,SUM(SUSPECT_PRODUCT_NUM1) AS  SUSPECT_PRODUCT_NUM1,SUM(RECUT_NUM1) AS RECUT_NUM1"
					+ ",SUM(SCRAP_NUM2) AS SCRAP_NUM2,SUM(QUALIFIED_NUM2) AS QUALIFIED_NUM2,SUM(REINSPECTION_NUM2) AS REINSPECTION_NUM2"
					+ ",SUM(REINSPECTION_QUALIFIED_NUM2) AS REINSPECTION_QUALIFIED_NUM2,SUM(OFFLINE_NUM2) AS OFFLINE_NUM2,SUM(BACKLINE_NUM2) AS BACKLINE_NUM2"
					+ ",SUM(DETECTION_NUM2) AS DETECTION_NUM2,SUM(SUSPECT_PRODUCT_NUM2) AS SUSPECT_PRODUCT_NUM2,SUM(RECUT_NUM2) AS RECUT_NUM2"
					+ ",SUM(SCRAP_NUM3) AS SCRAP_NUM3,SUM(QUALIFIED_NUM3) AS QUALIFIED_NUM3,SUM(REINSPECTION_NUM3) AS REINSPECTION_NUM3"
					+ ",SUM(REINSPECTION_QUALIFIED_NUM3) AS REINSPECTION_QUALIFIED_NUM3,SUM(OFFLINE_NUM3) AS OFFLINE_NUM3,SUM(BACKLINE_NUM3) AS BACKLINE_NUM3"
					+ ",SUM(DETECTION_NUM3) AS DETECTION_NUM3,SUM(SUSPECT_PRODUCT_NUM3) AS SUSPECT_PRODUCT_NUM3,SUM(RECUT_NUM3) AS RECUT_NUM3"
					+ ",SUM(SCRAP_NUM) AS SCRAP_NUM,SUM(QUALIFIED_NUM) AS QUALIFIED_NUM,SUM(REINSPECTION_NUM) AS REINSPECTION_NUM"
					+ ",SUM(REINSPECTION_QUALIFIED_NUM) AS REINSPECTION_QUALIFIED_NUM,SUM(OFFLINE_NUM) AS OFFLINE_NUM,SUM(BACKLINE_NUM) AS BACKLINE_NUM"
					+ ",SUM(DETECTION_NUM) AS DETECTION_NUM,SUM(SUSPECT_PRODUCT_NUM) AS SUSPECT_PRODUCT_NUM,SUM(RECUT_NUM) AS RECUT_NUM ";
			sql5 += " FROM MIL_TESTING_RESULT_DETAIL WHERE JUDGE_STOVE_NO='"
					+ JudgeStoveNo + "' AND PLINE_CODE='" + plincode
					+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
					+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
					+ "','/')";
			String sql = "MERGE INTO ";
			// if (TestMethod.contains("涡流"))// ET
			if (plincode.equals("C010")) {
				sql += " MIL_ET_RESULT T1";
			}
			// if (TestMethod.contains("漏磁"))// MT
			if (plincode.equals("C009") || plincode.equals("C008")
					|| plincode.equals("C017") || plincode.equals("C072")) {
				sql += " MIL_MT_RESULT T1";
			}
			// if (TestMethod.contains("超声波"))// UL
			if (plincode.equals("C012")) {
				sql += " MIL_UL_RESUL T1";
			}
			sql += " USING ( " + sql5 + " ) T2 ON (T1.JUDGE_STOVE_NO='"
					+ JudgeStoveNo + "' AND T1.PLINE_CODE='" + plincode
					+ "' ) WHEN MATCHED THEN ";
			sql += " UPDATE SET  T1.SCRAP_NUM1=(CASE T2.SCRAP_NUM1 WHEN null THEN 0 ELSE T2.SCRAP_NUM1 END),T1.QUALIFIED_NUM1=( CASE T2.QUALIFIED_NUM1 WHEN null THEN 0 ELSE T2.QUALIFIED_NUM1 END),T1.REINSPECTION_NUM1= (CASE T2.REINSPECTION_NUM1 WHEN null THEN 0 ELSE T2.REINSPECTION_NUM1 END )"
					+ ",T1.REINSPECTION_QUALIFIED_NUM1=(CASE T2.REINSPECTION_QUALIFIED_NUM1 WHEN null THEN 0 ELSE T2.REINSPECTION_QUALIFIED_NUM1 END),T1.DETECTION_NUM1=(CASE T2.DETECTION_NUM1 WHEN null THEN 0 ELSE T2.DETECTION_NUM1 END),T1.SUSPECT_PRODUCT_NUM1=(CASE T2.SUSPECT_PRODUCT_NUM1 WHEN null THEN 0 ELSE T2.SUSPECT_PRODUCT_NUM1 END )"
					+ ",T1.RECUT_NUM1=(CASE T2.RECUT_NUM1 WHEN null THEN 0 ELSE T2.RECUT_NUM1 END ) ,T1.SCRAP_NUM2=(CASE T2.SCRAP_NUM2 WHEN null THEN 0 ELSE T2.SCRAP_NUM2 END ),T1.QUALIFIED_NUM2=(CASE T2.QUALIFIED_NUM2 WHEN null THEN 0 ELSE T2.QUALIFIED_NUM2 END) ,T1.REINSPECTION_NUM2=(CASE T2.REINSPECTION_NUM2 WHEN null THEN 0 ELSE  T2.REINSPECTION_NUM2 END )"
					+ ",T1.REINSPECTION_QUALIFIED_NUM2= (CASE T2.REINSPECTION_QUALIFIED_NUM2 WHEN null THEN 0 ELSE T2.REINSPECTION_QUALIFIED_NUM2 END),T1.DETECTION_NUM2=(CASE  T2.DETECTION_NUM2 WHEN null THEN 0 ELSE T2.DETECTION_NUM2 END ),T1.SUSPECT_PRODUCT_NUM2=(CASE T2.SUSPECT_PRODUCT_NUM2 WHEN null THEN 0 ELSE T2.SUSPECT_PRODUCT_NUM2 END )"
					+ ",T1.RECUT_NUM2=(CASE T2.RECUT_NUM2 WHEN null THEN 0 ELSE T2.RECUT_NUM2 END ) ,T1.SCRAP_NUM=(CASE T2.SCRAP_NUM WHEN null THEN 0 ELSE T2.SCRAP_NUM END ),T1.QUALIFIED_NUM= (CASE T2.QUALIFIED_NUM WHEN null THEN 0 ELSE T2.QUALIFIED_NUM END ),T1.REINSPECTION_NUM=(CASE T2.REINSPECTION_NUM WHEN null THEN 0 ELSE T2.REINSPECTION_NUM END )"
					+ ",T1.REINSPECTION_QUALIFIED_NUM=(CASE T2.REINSPECTION_QUALIFIED_NUM WHEN null THEN 0 ELSE T2.REINSPECTION_QUALIFIED_NUM END),T1.DETECTION_NUM=(CASE T2.DETECTION_NUM  WHEN null THEN 0 ELSE T2.DETECTION_NUM END )";
			// if (TestMethod.contains("漏磁"))
			if (plincode.equals("C009") || plincode.equals("C008")
					|| plincode.equals("C017") || plincode.equals("C072")) {
				sql += ",T1.ALARM_NUM=(CASE  T2.SUSPECT_PRODUCT_NUM WHEN null THEN 0 ELSE T2.SUSPECT_PRODUCT_NUM  END ),T1.RECUT_NUM=(CASE T2.RECUT_NUM WHEN null THEN 0 ELSE T2.RECUT_NUM END) ";
			} else {
				sql += ",T1.SUSPECT_PRODUCT_NUM=(CASE T2.SUSPECT_PRODUCT_NUM WHEN null THEN 0 ELSE T2.SUSPECT_PRODUCT_NUM END ),T1.RECUT_NUM=(CASE T2.RECUT_NUM WHEN null THEN 0 ELSE T2.RECUT_NUM END) ";
			}
			// if (TestMethod.contains("涡流"))// ET)
			if (plincode.equals("C010")) {
				sql += " ,T1.SCRAP_NUM3=(CASE T2.SCRAP_NUM3 WHEN null THEN 0 ELSE T2.SCRAP_NUM3 END ),T1.QUALIFIED_NUM3=(CASE T2.QUALIFIED_NUM3 WHEN null THEN 0 ELSE  T2.QUALIFIED_NUM3 END ) ,T1.REINSPECTION_NUM3=(CASE T2.REINSPECTION_NUM3 WHEN null THEN 0 ELSE T2.REINSPECTION_NUM3 END)"
						+ ",T1.REINSPECTION_QUALIFIED_NUM3=( CASE T2.REINSPECTION_QUALIFIED_NUM3 WHEN null THEN 0 ELSE T2.REINSPECTION_QUALIFIED_NUM3 END ),T1.DETECTION_NUM3=(CASE T2.DETECTION_NUM3 WHEN null THEN 0 ELSE T2.DETECTION_NUM3 END)"
						+ ",T1.SUSPECT_PRODUCT_NUM3= (CASE T2.SUSPECT_PRODUCT_NUM3 WHEN null THEN 0 ELSE T2.SUSPECT_PRODUCT_NUM3 END )"
						+ ",T1.RECUT_NUM3=(CASE T2.RECUT_NUM3 WHEN null THEN 0 ELSE T2.RECUT_NUM3 END )";
			}
			sqllist.add(sql);
			if (flag.equals("0"))// 结炉回退
			{
				String sqltemp = "UPDATE  ";
				// if (TestMethod.contains("涡流"))// ET
				if (plincode.equals("C010")) {
					sqltemp += " MIL_ET_RESULT T1 SET T1.NODE_FUR_FLAG3=0,";
				}
				// if (TestMethod.contains("漏磁"))// MT
				if (plincode.equals("C009") || plincode.equals("C008")
						|| plincode.equals("C017") || plincode.equals("C072")) {
					sqltemp += " MIL_MT_RESULT T1 SET ";
				}
				// if (TestMethod.contains("超声波"))// UL
				if (plincode.equals("C012")) {
					sqltemp += " MIL_UL_RESUL T1 SET ";
				}
				sqltemp += " T1.NODE_FUR_FLAG=0, T1.NODE_FUR_FLAG1=0, T1.NODE_FUR_FLAG2=0 ";
				sqltemp += " WHERE JUDGE_STOVE_NO='" + JudgeStoveNo
						+ "' AND RESULT_NO='" + ResultNo
						+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
						+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
						+ "','/')";
				sqllist.add(sqltemp);
				String sqltemp2 = "UPDATE MIL_PLAN T SET T.NODE_STATUS='80' WHERE T.JUDGE_STOVE_NO='"
						+ JudgeStoveNo
						+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
						+ proPlanId
						+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
						+ gxPlanNo + "','/')";
				String sql15 = " UPDATE PORT_MIL_BATCH_SAMPLE_RESULT T SET T.STATUS = '0',T.OP_PROCESS = '',T.RECUT_LENGTH = '',T.CUT_ACT_THEORY_WEIGHT = '' WHERE T.JUDGE_STOVE_NO = '"
						+ JudgeStoveNo
						+ "' AND T.PLAN_ID = '"
						+ ResultNo
						+ "' AND T.OP_PROCESS = '"
						+ String.valueOf(bProcessNo)
						+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
						+ proPlanId
						+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
						+ gxPlanNo
						+ "','/')";
				sqllist.add(sqltemp2);
				sqllist.add(sql15);
			}
		} else {
			if (flag.equals("0"))// 结炉回退
			{
				String sqltemp = "UPDATE  ";
				// if (TestMethod.contains("涡流"))// ET
				if (plincode.equals("C010")) {
					sqltemp += " MIL_ET_RESULT T1 SET T1.NODE_FUR_FLAG3=0,";
				}
				// if (TestMethod.contains("漏磁"))// MT
				if (plincode.equals("C009") || plincode.equals("C008")
						|| plincode.equals("C017") || plincode.equals("C072")) {
					sqltemp += " MIL_MT_RESULT T1 SET ";
				}
				// if (TestMethod.contains("超声波"))// UL
				if (plincode.equals("C012")) {
					sqltemp += " MIL_UL_RESUL T1 SET ";
				}
				sqltemp += " T1.NODE_FUR_FLAG=0, T1.NODE_FUR_FLAG1=0, T1.NODE_FUR_FLAG2=0 ";
				sqltemp += " WHERE JUDGE_STOVE_NO='" + JudgeStoveNo
						+ "' AND RESULT_NO='" + ResultNo
						+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('" + proPlanId
						+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('" + gxPlanNo
						+ "','/')";
				sqllist.add(sqltemp);
				String sqltemp2 = "UPDATE MIL_PLAN T SET T.NODE_STATUS='80' WHERE T.JUDGE_STOVE_NO='"
						+ JudgeStoveNo
						+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
						+ proPlanId
						+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
						+ gxPlanNo + "','/')";
				sqllist.add(sqltemp2);
				String sqltemp3 = CoreXmlSqlParsersFactory
						.getSql("NodeBack.UpdateShift");
				sqltemp3 = sqltemp3.replace("#JUDGE_STOVE_NO#", JudgeStoveNo)
						.replace("#RESULT_NO#", ResultNo);
				String sqltemp4 = "UPDATE MIL_QA_RACK T SET T.MAT_NO = '' WHERE T.JUDGE_STOVE_NO = '"
						+ JudgeStoveNo
						+ "' AND T.RESULT_NO = '"
						+ ResultNo
						+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
						+ proPlanId
						+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
						+ gxPlanNo
						+ "','/')";
				String sql15 = " UPDATE PORT_MIL_BATCH_SAMPLE_RESULT T SET T.STATUS = '0',T.OP_PROCESS = '' WHERE T.JUDGE_STOVE_NO = '"
						+ JudgeStoveNo
						+ "' AND T.PLAN_ID = '"
						+ ResultNo
						+ "' AND T.OP_PROCESS = '"
						+ String.valueOf(bProcessNo)
						+ "' AND NVL(PRO_PLAN_ID,'/') = NVL('"
						+ proPlanId
						+ "','/') AND NVL(GX_PLAN_NO,'/') = NVL('"
						+ gxPlanNo
						+ "','/')";

				// 更新进程表mil_processes数据
				String updateProcess = CoreXmlSqlParsersFactory
						.getSql("FrmInOnlineStore.insertMilProcess2");
				updateProcess = updateProcess.replace("#JUDGE_STOVE_NO#",
						JudgeStoveNo).replace("#LOT_NO#", lotNo).replace(
						"#PLINE_CODE#", plincode).replace("#PRO_PLAN_ID#",
						proPlanId).replace("#GX_PLAN_NO#", gxPlanNo);

				sqllist.add(sqltemp3);
				sqllist.add(sqltemp4);
				sqllist.add(sql15);
				sqllist.add(updateProcess);
			}

		}
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);
	}

	/***
	 * 查询探伤是否存在下线支数
	 * 
	 * @param jugeNo
	 * @param plineCode
	 * @return
	 */
	public CoreReturnObject doQueryOffine(String jugeNo, String plineCode,
			String proPlanId, String gxPlanNo) {
		return this.getDataBySqlID("EddyCurrentTestingResult.doQueryOffine",
				new Object[] { jugeNo, plineCode, proPlanId, gxPlanNo });
	}

	/***
	 * 查询矫直合格支数
	 * 
	 * @param heatNo
	 * @return
	 */
	public CoreReturnObject selectStraith(String heatNo) {
		return this.getDataBySqlID("EddyCurrentTestingResult.selectStraith",
				new Object[] { heatNo });
	}

	/***
	 * 查询该班次班组的实绩信息
	 * 
	 * @param jugeNo
	 * @param colOrder
	 * @param colGroup
	 * @return
	 */
	public CoreReturnObject getMtDetail(String jugeNo, String colOrder,
			String colGroup, String proPlanId, String gxPlanNo) {
		return this
				.getDataBySqlID("EddyCurrentTestingResult.getMtDetail",
						new Object[] { jugeNo, colOrder, colGroup, proPlanId,
								gxPlanNo });
	}

	/***
	 * 查询可疑品
	 * 
	 * @param parm
	 * @return
	 */
	public CoreReturnObject doQueryAlarmNum(ArrayList<String> parm) {
		return this.getDataBySqlID("EddyCurrentTestingResult.doQueryAlarmNum",
				parm.toArray());
	}

	/***
	 * 查询剔除品
	 * 
	 * @param parm
	 * @return
	 */
	public CoreReturnObject doQueryScrapNum(ArrayList<String> parm) {
		return this.getDataBySqlID("EddyCurrentTestingResult.doQueryScrapNumS",
				parm.toArray());
	}

	/***
	 * 查询已探伤的下线品
	 * 
	 * @param parm
	 * @return
	 */
	public CoreReturnObject doQueryOffineNum(ArrayList<String> parm) {
		return this.getDataBySqlID("EddyCurrentTestingResult.doQueryOffineNum",
				parm.toArray());
	}

	/***
	 * 保存所有可疑品、剔除品
	 * 
	 * @param alarmList
	 * @param scarpList
	 * @param list
	 * @return
	 */
	public CoreReturnObject saveScrapData(
			ArrayList<ArrayList<String>> alarmList,
			ArrayList<ArrayList<String>> scarpList,
			ArrayList<ArrayList<String>> offlinelist, ArrayList<String> list,
			String strInBound, String strInMemo, String plineCode,
			ArrayList<String> parm) {
		CoreReturnObject cro = new CoreReturnObject();
		Connection connection = this.getDao(CoreConstantData.sysbeanstr)
				.getConnection();
		PreparedStatement psta = null;
		String sql = "";
		ResultSet rs = null;
		Date now = new Date();
		SimpleDateFormat dateFormat = new SimpleDateFormat(
				"yyyy-MM-dd HH:mm:ss");
		SimpleDateFormat df = new SimpleDateFormat("yyyyMM");
		String systime = dateFormat.format(now);
		String yearMoth = df.format(now);
		int offNum = 0;

		String materiaNo = "";// 物料码
		String materiaName = "";// 物料描述
		String INWL_ID = "";// 投入物料编码
		String INWL_DESC = "";// 投入物料描述
		String CRAFT_SEQ = ""; // 工艺序号
		String judgeStdDes = ""; // 判定标准集合
		String cic = ""; // cic
		String offlineDoc = ""; // 离线单号

		try {
			connection.setAutoCommit(false); // 取消自动提交事务
			String deleteSql = CoreXmlSqlParsersFactory
					.getSql("saveScrapData.deleteSql");// 回滚所有状态
			PreparedStatement deletePsta = connection
					.prepareStatement(deleteSql);
			String saveAlarmSql = CoreXmlSqlParsersFactory
					.getSql("saveScrapData.alarmNum");// 保存可疑品
			PreparedStatement saveAlarmPsta = connection
					.prepareStatement(saveAlarmSql);
			String saveScrapSql = CoreXmlSqlParsersFactory
					.getSql("saveScrapData.scrapNum");// 保存剔除品
			PreparedStatement saveScrapPsta = connection
					.prepareStatement(saveScrapSql);
			String saveOfflineSql = CoreXmlSqlParsersFactory
					.getSql("saveScrapData.offlineNum");// 保存下线品
			PreparedStatement saveOfflinePsta = connection
					.prepareStatement(saveOfflineSql);
			String saveOfflineResultSql = CoreXmlSqlParsersFactory
					.getSql("saveScrapData.insertOffResult");// 插入下线表
			PreparedStatement saveOfflineResultPsta = connection
					.prepareStatement(saveOfflineResultSql);

			String insertMatSql = CoreXmlSqlParsersFactory
					.getSql("FrmOffLine.insertMatTS");
			PreparedStatement insertMatPsta = connection
					.prepareStatement(insertMatSql);
			String insertInListSql = CoreXmlSqlParsersFactory
					.getSql("FrmOffLine.insertInListX");// 待处理数据入在线库
			PreparedStatement insertListPsta = connection
					.prepareStatement(insertInListSql);

			sql = CoreXmlSqlParsersFactory.getSql("FrmOffLine.offlineDoc");// 离线单号
			psta = connection.prepareStatement(sql);
			rs = psta.executeQuery();
			if (rs.next()) {
				offlineDoc = rs.getString("OFFLINE_DOC");
			}
			rs.close();
			psta.close();

			deletePsta.setString(1, list.get(0));// 实绩编号
			deletePsta.setString(2, list.get(2));// 炉号
			deletePsta.setString(3, list.get(3));// 班次
			deletePsta.setString(4, list.get(4));// 班组
			deletePsta.setString(5, list.get(5));// 台号
			deletePsta.setString(6, list.get(6));// 轧管订单编号
			deletePsta.setString(7, list.get(7));// 工序排产序号
			/*
			 * deletePsta.setString(6, list.get(0));// 实绩编号
			 * deletePsta.setString(7, list.get(2));// 炉号
			 * deletePsta.setString(8, list.get(3));// 班次
			 * deletePsta.setString(9, list.get(4));// 班组
			 * deletePsta.setString(10, list.get(5));// 台号
			 * 
			 * deletePsta.setString(11, list.get(0));// 实绩编号
			 * deletePsta.setString(12, list.get(2));// 炉号
			 * deletePsta.setString(13, list.get(3));// 班次
			 * deletePsta.setString(14, list.get(4));// 班组
			 * deletePsta.setString(15, list.get(5));// 台号
			 * 
			 * deletePsta.setString(16, list.get(2)); deletePsta.setString(17,
			 * list.get(0)); deletePsta.setString(18, list.get(2));
			 * deletePsta.setString(19, list.get(2)); deletePsta.setString(20,
			 * list.get(2));
			 * 
			 * deletePsta.setString(21, list.get(0));// 实绩编号
			 * deletePsta.setString(22, list.get(2));// 炉号
			 * deletePsta.setString(23, list.get(3));// 班次
			 * deletePsta.setString(24, list.get(4));// 班组
			 * deletePsta.setString(25, list.get(5));// 台号
			 * deletePsta.setString(26, list.get(0));// 实绩编号
			 * deletePsta.setString(27, list.get(2));// 炉号
			 * deletePsta.setString(28, list.get(3));// 班次
			 * deletePsta.setString(29, list.get(4));// 班组
			 * deletePsta.setString(30, list.get(5));// 台号
			 * deletePsta.setString(31, list.get(0));// 实绩编号
			 * deletePsta.setString(32, list.get(2));// 炉号
			 * deletePsta.setString(33, list.get(5));// 台号
			 * deletePsta.setString(34, list.get(2));// 炉号
			 * deletePsta.setString(35, list.get(0));// 实绩编号
			 * deletePsta.setString(36, list.get(2));// 炉号
			 * deletePsta.setString(37, list.get(3));// 班次
			 * deletePsta.setString(38, list.get(4));// 班组
			 * deletePsta.setString(39, list.get(5));// 台号
			 */
			deletePsta.addBatch();
			for (int i = 0; i < alarmList.size(); i++) {
				ArrayList<String> alarm = (ArrayList<String>) alarmList.get(i);
				// saveAlarmPsta.setString(1, list.get(0));//实绩编号
				// saveAlarmPsta.setString(2, list.get(2));//炉号
				// saveAlarmPsta.setString(3, alarm.get(0));//可疑原因
				// saveAlarmPsta.setString(4, list.get(5));//台号

				saveAlarmPsta.setString(1, list.get(0));
				saveAlarmPsta.setString(2, list.get(1));
				saveAlarmPsta.setString(3, list.get(2));
				saveAlarmPsta.setString(4, plineCode);
				saveAlarmPsta.setString(5, list.get(3));
				saveAlarmPsta.setString(6, list.get(4));
				saveAlarmPsta.setString(7, alarm.get(0));
				saveAlarmPsta.setString(8, alarm.get(1));
				saveAlarmPsta.setString(9, "可疑");
				saveAlarmPsta.setString(10, list.get(5));
				saveAlarmPsta.setString(11, list.get(6));// 轧管订单编号
				saveAlarmPsta.setString(12, list.get(7));// 工序排产序号
				// saveAlarmPsta.setString(11, list.get(2));
				saveAlarmPsta.setString(13, list.get(0));// 实绩编号
				saveAlarmPsta.setString(14, list.get(2));// 炉号
				saveAlarmPsta.setString(15, list.get(6));// 轧管订单编号
				saveAlarmPsta.setString(16, list.get(7));// 工序排产序号
				saveAlarmPsta.setInt(17, Integer.parseInt(alarm.get(1)));
				saveAlarmPsta.setString(18, list.get(5));
				saveAlarmPsta.setString(19, alarm.get(0));
				saveAlarmPsta.setString(20, list.get(0));
				saveAlarmPsta.setString(21, list.get(2));
				saveAlarmPsta.setString(22, list.get(6));// 轧管订单编号
				saveAlarmPsta.setString(23, list.get(7));// 工序排产序号
				saveAlarmPsta.addBatch();
			}

			for (int j = 0; j < scarpList.size(); j++) {
				ArrayList<String> scarp = (ArrayList<String>) scarpList.get(j);
				saveScrapPsta.setString(1, list.get(0));// 实绩编号
				saveScrapPsta.setString(2, list.get(1));// 批号
				saveScrapPsta.setString(3, list.get(2));// 炉号
				saveScrapPsta.setString(4, plineCode);// 产线
				saveScrapPsta.setString(5, list.get(3));// 班次
				saveScrapPsta.setString(6, list.get(4));// 班组
				saveScrapPsta.setString(7, scarp.get(0));// 剔除原因
				saveScrapPsta.setString(8, scarp.get(1));// 剔除支数
				saveScrapPsta.setString(9, "剔除");
				saveScrapPsta.setString(10, list.get(5));// 台号
				saveScrapPsta.setString(11, scarp.get(3));// 报警原因
				saveScrapPsta.setString(12, list.get(6));// 轧管订单编号
				saveScrapPsta.setString(13, list.get(7));// 工序排产序号

				saveScrapPsta.setString(14, plineCode);
				saveScrapPsta.setString(15, list.get(0));
				saveScrapPsta.setString(16, list.get(2));
				saveScrapPsta.setString(17, list.get(6));// 轧管订单编号
				saveScrapPsta.setString(18, list.get(7));// 工序排产序号

				saveScrapPsta.setString(19, scarp.get(3));// 报警原因
				saveScrapPsta.setString(20, list.get(5));// 台号
				saveScrapPsta.setInt(21, Integer.parseInt(scarp.get(1)));
				saveScrapPsta.setString(22, list.get(5));
				saveScrapPsta.setString(23, "0");
				saveScrapPsta.setString(24, list.get(2));
				saveScrapPsta.setString(25, "10");
				saveScrapPsta.setString(26, "0");
				saveScrapPsta.setString(27, "1");
				saveScrapPsta.setString(28, "");// 剔除人
				saveScrapPsta.setString(29, list.get(3));
				saveScrapPsta.setString(30, list.get(4));
				saveScrapPsta.setString(31, list.get(0));
				saveScrapPsta.setString(32, list.get(6));// 轧管订单编号
				saveScrapPsta.setString(33, list.get(7));// 工序排产序号

				saveScrapPsta.setString(34, list.get(5));
				saveScrapPsta.setString(35, scarp.get(0));
				saveScrapPsta.setString(36, list.get(0));
				saveScrapPsta.setString(37, list.get(2));
				saveScrapPsta.setString(38, list.get(6));// 轧管订单编号
				saveScrapPsta.setString(39, list.get(7));// 工序排产序号

				saveScrapPsta.setString(40, list.get(0));
				saveScrapPsta.setString(41, list.get(2));
				saveScrapPsta.setString(42, list.get(6));// 轧管订单编号
				saveScrapPsta.setString(43, list.get(7));// 工序排产序号
				saveScrapPsta.setString(44, scarp.get(3));// 报警原因
				saveScrapPsta.setString(45, list.get(5));// 台号
				saveScrapPsta.setInt(46, Integer.parseInt(scarp.get(1)));
				saveScrapPsta.setString(47, list.get(5));
				saveScrapPsta.setString(48, "0");
				saveScrapPsta.setString(49, list.get(2));
				saveScrapPsta.setString(50, "10");
				saveScrapPsta.setString(51, "0");
				saveScrapPsta.setString(52, "1");
				saveScrapPsta.setString(53, "");// 剔除人
				saveScrapPsta.setString(54, list.get(3));
				saveScrapPsta.setString(55, list.get(4));
				saveScrapPsta.setString(56, list.get(0));
				saveScrapPsta.setString(57, list.get(6));// 轧管订单编号
				saveScrapPsta.setString(58, list.get(7));// 工序排产序号

				saveScrapPsta.setString(59, list.get(5));
				saveScrapPsta.setString(60, scarp.get(0));
				saveScrapPsta.setString(61, list.get(0));
				saveScrapPsta.setString(62, list.get(2));
				saveScrapPsta.setString(63, list.get(6));// 轧管订单编号
				saveScrapPsta.setString(64, list.get(7));// 工序排产序号

				saveScrapPsta.addBatch();
			}

			String jugeNo = list.get(2).replaceFirst("-.*", "");
			String bacthNo = "X";
			String groupNo = "001";

			for (int k = 0; k < offlinelist.size(); k++) {
				ArrayList<String> offline = (ArrayList<String>) offlinelist
						.get(k);
				saveOfflinePsta.setString(1, list.get(0));// 实绩编号
				saveOfflinePsta.setString(2, list.get(1));// 批号
				saveOfflinePsta.setString(3, list.get(2));// 炉号
				saveOfflinePsta.setString(4, plineCode);// 产线
				saveOfflinePsta.setString(5, list.get(3));// 班次
				saveOfflinePsta.setString(6, list.get(4));// 班组
				saveOfflinePsta.setString(7, offline.get(0));// 下线原因
				saveOfflinePsta.setString(8, offline.get(1));// 下线支数
				saveOfflinePsta.setString(9, "下线");
				saveOfflinePsta.setString(10, list.get(5));// 台号
				saveOfflinePsta.setString(11, list.get(6));// 轧管订单编号
				saveOfflinePsta.setString(12, list.get(7));// 工序排产序号

				saveOfflinePsta.setString(13, list.get(0));// 实绩编号
				saveOfflinePsta.setString(14, list.get(2));// 炉号
				saveOfflinePsta.setString(15, list.get(6));// 轧管订单编号
				saveOfflinePsta.setString(16, list.get(7));// 工序排产序号

				saveOfflinePsta.setString(17, list.get(5));// 台号
				saveOfflinePsta.setInt(18, Integer.parseInt(offline.get(1)));
				saveOfflinePsta.setString(19, list.get(5));// 台号
				saveOfflinePsta.setString(20, offline.get(0));// 下线原因
				saveOfflinePsta.setString(21, list.get(0));// 实绩编号
				saveOfflinePsta.setString(22, list.get(2));// 炉号
				saveOfflinePsta.setString(23, list.get(6));// 轧管订单编号
				saveOfflinePsta.setString(24, list.get(7));// 工序排产序号

				saveOfflinePsta.setString(25, list.get(5));// 台号
				saveOfflinePsta.setString(26, "1");//
				saveOfflinePsta.setString(27, list.get(2));// 炉号
				saveOfflinePsta.setString(28, "10");//
				saveOfflinePsta.setString(29, "0");//
				saveOfflinePsta.setString(30, "1");//
				saveOfflinePsta.setString(31, "");
				saveOfflinePsta.setString(32, list.get(3));// 班次
				saveOfflinePsta.setString(33, list.get(4));// 班组
				saveOfflinePsta.setString(34, list.get(0));// 实绩编号
				saveOfflinePsta.setString(35, list.get(6));// 轧管订单编号
				saveOfflinePsta.setString(36, list.get(7));// 工序排产序号

				saveOfflinePsta.setString(37, offline.get(1));// 下线支数
				saveOfflinePsta.setString(38, list.get(0));// 实绩编号
				saveOfflinePsta.setString(39, list.get(2));// 炉号
				saveOfflinePsta.setString(40, list.get(6));// 轧管订单编号
				saveOfflinePsta.setString(41, list.get(7));// 工序排产序号

				saveOfflinePsta.setString(42, offline.get(1));// 下线支数
				saveOfflinePsta.setString(43, list.get(0));// 实绩编号
				saveOfflinePsta.setString(44, list.get(2));// 炉号
				saveOfflinePsta.setString(45, list.get(6));// 轧管订单编号
				saveOfflinePsta.setString(46, list.get(7));// 工序排产序号
				saveOfflinePsta.addBatch();

				saveOfflineResultPsta.setString(1, list.get(0));
				saveOfflineResultPsta.setString(2, list.get(2));

				saveOfflineResultPsta.setString(3, list.get(2));
				saveOfflineResultPsta.setInt(4, Integer.parseInt(offlinelist
						.get(k).get(1)));
				saveOfflineResultPsta.setInt(5, Integer.parseInt(offlinelist
						.get(k).get(1)));
				saveOfflineResultPsta.setString(6, list.get(2));
				saveOfflineResultPsta.setString(7, list.get(0));
				saveOfflineResultPsta.setString(8, list.get(2));
				saveOfflineResultPsta.setString(9, offlinelist.get(k).get(1));
				saveOfflineResultPsta.setString(10, "");
				saveOfflineResultPsta.setString(11, list.get(3));
				saveOfflineResultPsta.setString(12, list.get(4));
				saveOfflineResultPsta.setString(13, offlinelist.get(k).get(1));// 支数
				saveOfflineResultPsta.setString(14, offlineDoc);// 离线单号
				saveOfflineResultPsta.addBatch();

				offNum = offNum + Integer.parseInt(offline.get(1));
			}
			if (offNum > 0) {

				String inListDoc = querySendSqlDoc(connection, strInBound,
						strInMemo, plineCode, systime);// 入库单号
				String inListSeq = querySendSql(connection, inListDoc,
						plineCode); // 入库流水号
				int n = Integer.parseInt(inListSeq.substring(
						inListSeq.length() - 4, inListSeq.length()));
				String matNo = queryMatNoM(connection, jugeNo, bacthNo); // 材料号
				int g = Integer.parseInt(matNo.substring(matNo.length() - 4,
						matNo.length()));

				sql = CoreXmlSqlParsersFactory
						.getSql("EddyCurrentTestingResult.SelectPipeSizeLen");// 查询轧管规格\目标长度
				psta = connection.prepareStatement(sql);
				psta.setString(1, list.get(2));
				rs = psta.executeQuery();
				List<MilPlanEntity3> milList = EntityTool.getEntitysByRs(rs,
						MilPlanEntity3.class);
				rs.close();
				psta.close();

				sql = CoreXmlSqlParsersFactory
						.getSql("FrmOffLine.selectMaterialNo");// 查询物料码
				psta = connection.prepareStatement(sql);
				psta.setString(1, list.get(6)); // 轧管订单编号
				psta.setString(2, list.get(7)); // 工序排产序号
				rs = psta.executeQuery();
				if (rs.next()) {
					judgeStdDes = rs.getString("judgeStdDes");
					cic = rs.getString("CIC");
					materiaNo = rs.getString("OUTWL_ID");
					materiaName = rs.getString("OUTWL_DESC");
					INWL_ID = rs.getString("INWL_ID");
					INWL_DESC = rs.getString("INWL_DESC");
					CRAFT_SEQ = rs.getString("CRAFT_SEQ");
				}
				rs.close();
				psta.close();

				if (plineCode.equals("C010")) {
					milList.get(0).setPlineName("168机组");
				} else if (plineCode.equals("C017")) {
					milList.get(0).setPlineName("460机组");
				} else if (plineCode.equals("C009")) {
					milList.get(0).setPlineName("258机组");
				} else if (plineCode.equals("C008")) {
					milList.get(0).setPlineName("250机组");
				} else if (plineCode.equals("C072")) {
					milList.get(0).setPlineName("天淮508机组");
				}

				String[] lengthCp = milList.get(0).getLengthRange().replace(
						"米", "").split("[-]");
				String[] str = milList.get(0).getPipeSize().split("[*]");
				double strWgt = 0.02466
						* Double.parseDouble(str[1])
						* (Double.parseDouble(str[0]) - Double
								.parseDouble(str[1]))
						* Double.parseDouble(milList.get(0).getTargetLength())
						* offNum / 1000;
				List<double[]> list1 = MeanValueCalculation.MeanCalculation(
						Double.parseDouble(new DecimalFormat("0.000")
								.format(strWgt)), offNum);
				for (int j = 0; j < list1.size(); j++) {
					double[] conW = list1.get(j);
					if ((int) conW[0] >= 0) {
						for (int z = 0; z < (int) conW[0]; z++) {
							insertMatPsta.setString(1, jugeNo);
							insertMatPsta.setString(2, bacthNo);
							insertMatPsta.setString(3, groupNo);
							insertMatPsta.setString(4, parm.get(0));
							insertMatPsta.setString(5, parm.get(1));
							insertMatPsta.setString(6, parm.get(2));
							insertMatPsta.setString(7, parm.get(3));
							insertMatPsta.setString(8, parm.get(4));
							insertMatPsta.setString(9, (jugeNo + bacthNo)
									+ StringTool.formatDecimal(g, "0000"));
							insertMatPsta.setString(10, parm.get(5));
							insertMatPsta.setString(11, parm.get(6));
							insertMatPsta.setString(12, parm.get(7));
							insertMatPsta.setString(13, parm.get(8));

							insertMatPsta.setString(14, jugeNo);
							insertMatPsta.setString(15, bacthNo);
							insertMatPsta.setString(16, groupNo);
							insertMatPsta.setString(17, "1");
							insertMatPsta
									.setString(18, String.valueOf(conW[1]));
							insertMatPsta.setString(19, systime);
							insertMatPsta.setString(20, (jugeNo + bacthNo)
									+ StringTool.formatDecimal(g, "0000"));
							insertMatPsta.setString(21, "801401");
							insertMatPsta.setString(22, "80150104");
							insertMatPsta.setString(23, milList.get(0)
									.getPlineCode());
							insertMatPsta.setString(24, milList.get(0)
									.getPlineName());
							insertMatPsta.setString(25, "11");
							insertMatPsta.setString(26, milList.get(0).getId());
							insertMatPsta.setString(27, milList.get(0)
									.getJudgeStoveNo());
							insertMatPsta.setString(28, "");
							insertMatPsta.setString(29, milList.get(0)
									.getVarieties());
							insertMatPsta.setString(30, "");
							insertMatPsta.setString(31, milList.get(0)
									.getSteelname());
							insertMatPsta.setString(32, "");
							insertMatPsta.setString(33, milList.get(0)
									.getPipeSize().replace("*", "x"));
							insertMatPsta.setString(34, "");
							insertMatPsta.setString(35, milList.get(0)
									.getGradename());
							insertMatPsta.setString(36, "");
							insertMatPsta.setString(37, milList.get(0)
									.getBuckleType());
							insertMatPsta.setString(38, "");
							insertMatPsta.setString(39, milList.get(0)
									.getRollStandrad());
							insertMatPsta.setString(40, parm.get(5));
							insertMatPsta.setString(41, parm.get(6));
							insertMatPsta.setString(42, milList.get(0)
									.getStdStyle());
							insertMatPsta.setString(43, milList.get(0)
									.getStdStyleDesc());
							insertMatPsta.setString(44, str[0].toString());
							insertMatPsta.setString(45, str[1].toString());
							insertMatPsta.setString(46, lengthCp[0].toString());
							insertMatPsta.setString(47, lengthCp[1].toString());
							insertMatPsta.setString(48, milList.get(0)
									.getLotNo());
							insertMatPsta.setString(49, milList.get(0)
									.getContractNo());
							insertMatPsta.setString(50, milList.get(0)
									.getTargetLength());
							insertMatPsta.setString(51, milList.get(0)
									.getTarget());
							insertMatPsta.setString(52, milList.get(0)
									.getProcessStatus());
							insertMatPsta.setString(53, jugeNo);
							insertMatPsta.setString(54, milList.get(0)
									.getStoveNo());

							insertMatPsta.setString(55, materiaNo);
							insertMatPsta.setString(56, materiaName);
							insertMatPsta.setString(57, INWL_ID);
							insertMatPsta.setString(58, INWL_DESC);
							insertMatPsta.setString(59, cic);
							insertMatPsta.setString(60, judgeStdDes);
							insertMatPsta.setString(61, CRAFT_SEQ);
							insertMatPsta.setString(62, list.get(6)); // 轧管订单编号
							insertMatPsta.setString(63, list.get(7)); // 工序排产序号
							insertMatPsta.setString(64, offlineDoc); // 离线单号
							insertMatPsta.addBatch();

							insertListPsta.setString(1, parm.get(5));
							insertListPsta.setString(2, parm.get(6));
							insertListPsta.setString(3, inListDoc
									+ StringTool.formatDecimal(n, "0000"));
							insertListPsta.setString(4, inListDoc);
							insertListPsta.setString(5, "800701");
							insertListPsta.setString(6, "产出入库");
							insertListPsta.setString(7, (jugeNo + bacthNo)
									+ StringTool.formatDecimal(g, "0000"));
							insertListPsta.setString(8, milList.get(0)
									.getLotNo());
							insertListPsta.setString(9, milList.get(0)
									.getStoveNo());
							insertListPsta.setString(10, jugeNo);
							insertListPsta.setString(11, bacthNo);
							insertListPsta.setString(12, groupNo);

							insertListPsta.setString(13, "");
							insertListPsta.setString(14, milList.get(0)
									.getVarieties());
							insertListPsta.setString(15, "");// 标准
							insertListPsta.setString(16, milList.get(0)
									.getRollStandrad());
							insertListPsta.setString(17, "");
							insertListPsta.setString(18, milList.get(0)
									.getSteelname());
							insertListPsta.setString(19, "");
							insertListPsta.setString(20, milList.get(0)
									.getStdStyleDesc());
							insertListPsta.setString(21, "");
							insertListPsta.setString(22, milList.get(0)
									.getPipeSize().replace("*", "x"));
							insertListPsta.setString(23, "");
							insertListPsta.setString(24, milList.get(0)
									.getBuckleType());

							insertListPsta.setString(25, milList.get(0)
									.getDimater());
							insertListPsta.setString(26, milList.get(0)
									.getHeight());
							insertListPsta.setString(27, milList.get(0)
									.getLengthmin());
							insertListPsta.setString(28, milList.get(0)
									.getLengthmax());
							insertListPsta.setString(29, "1");
							insertListPsta.setString(30, String
									.valueOf(conW[1]));
							insertListPsta.setString(31, String
									.valueOf(conW[1]));
							insertListPsta.setString(32, parm.get(5));
							insertListPsta.setString(33, parm.get(6));
							insertListPsta.setString(34, parm.get(0));
							insertListPsta.setString(35, "");
							insertListPsta.setString(36, "1");
							insertListPsta.setString(37, parm.get(4));
							insertListPsta.setString(38, systime);
							insertListPsta.setString(39, "");// 合同号
							insertListPsta.setString(40, "");
							insertListPsta.setString(41, "");
							insertListPsta.setString(42, "");
							insertListPsta.setString(43, "");
							insertListPsta.setString(44, "");

							insertListPsta.setString(45, "801401");
							insertListPsta.setString(46, "80150101");
							insertListPsta.setString(47, systime);
							insertListPsta.setString(48, milList.get(0)
									.getTargetLength());// 长度
							insertListPsta.setString(49, parm.get(7));
							insertListPsta.setString(50, parm.get(8));
							insertListPsta.setString(51, milList.get(0)
									.getRollStandrad());
							insertListPsta.setString(52, milList.get(0)
									.getPlineCode());
							insertListPsta.setString(53, milList.get(0)
									.getPlineName());
							insertListPsta.setString(54, milList.get(0)
									.getGradecode());
							insertListPsta.setString(55, milList.get(0)
									.getGradename());
							insertListPsta.setString(56, yearMoth);
							insertListPsta.setString(57, systime);
							insertListPsta.setString(58, "");
							insertListPsta.setString(59, "801302");
							insertListPsta.setString(60, "机组");
							insertListPsta.setString(61, milList.get(0)
									.getPlineCode());
							insertListPsta.setString(62, milList.get(0)
									.getPlineName());
							insertListPsta.setString(63, "");
							insertListPsta.setString(64, "");
							insertListPsta.setString(65, milList.get(0)
									.getContractNo());
							insertListPsta.setString(66, "11");
							insertListPsta.setString(67, milList.get(0)
									.getJudgeStoveNo());
							insertListPsta.setString(68, parm.get(9));
							insertListPsta.setString(69, parm.get(10));
							insertListPsta.addBatch();
							g++;
							n++;
						}
					}
				}
			}

			deletePsta.executeBatch();
			saveAlarmPsta.executeBatch();
			saveScrapPsta.executeBatch();
			saveOfflinePsta.executeBatch();
			saveOfflineResultPsta.executeBatch();
			insertMatPsta.executeBatch();
			insertListPsta.executeBatch();
			cro.setV_errMsg("保存成功!");
			connection.commit();
		} catch (Exception e) {
			System.out.println(e.getMessage());
			if (connection != null) {
				try {
					cro.setV_errMsg(e.getMessage());
					connection.rollback(); // 回滚事务
				} catch (Exception e2) {
				}
			}
		} finally {
			try {
				if (connection != null && !connection.isClosed()) {
					connection.close();
				}
			} catch (Exception e2) {
			}
		}
		return cro;
	}

	/**
	 * 每支材料对应的入库单号
	 * 
	 * @param conn
	 *            c
	 * @param strlist
	 *            传递参数
	 * @return obj
	 * @throws Exception
	 *             异常处理
	 */
	public String querySendSqlDoc(Connection conn, String strlist, String memo,
			String plineCode, String systime) throws Exception {
		int seq = 0;
		String inListDoc = "";
		PreparedStatement psta = null;
		Date dt = new Date();
		SimpleDateFormat matter1 = new SimpleDateFormat("yyyy-MM-dd");
		SimpleDateFormat matter2 = new SimpleDateFormat("yyMMdd");
		String sqlLovsqe = CoreXmlSqlParsersFactory
				.getSql("FrmInOnlineStore.getInListDoc");
		psta = conn.prepareStatement(sqlLovsqe);
		psta.setString(1, memo);
		psta.setString(2, plineCode);
		psta.setString(3, systime);
		psta.setString(4, systime);
		// psta.setString(5, strlist);
		psta.setString(5, plineCode);
		ResultSet rs = psta.executeQuery();
		if (rs.next()) {
			// String res = rs.getString(1);
			// if (res == null) {
			// res = memo + plineCode + matter2.format(dt) + "00001";
			// } else {
			// //seq = Integer.parseInt(res.substring(8, 13));
			// seq = Integer.parseInt(res.substring(12, 17));
			// }
			inListDoc = rs.getString("INSTOCK_DOC");
		}
		rs.close();
		psta.close();
		// return memo + plineCode + matter2.format(dt)
		// + StringTool.formatDecimal(++seq, "00000");
		return inListDoc;
	}

	/**
	 * 每支材料对应的入库流水号
	 * 
	 * @param conn
	 *            c
	 * @param strlist
	 *            传递参数
	 * @return obj
	 * @throws Exception
	 *             异常处理
	 */
	public String querySendSql(Connection conn, String strlist, String plineCode)
			throws Exception {
		int seq = 0;
		String inListDocSeq = "";
		PreparedStatement psta = null;
		Date dt = new Date();
		SimpleDateFormat matter1 = new SimpleDateFormat("yyyy-MM-dd");
		String sqlLovsqe = CoreXmlSqlParsersFactory
				.getSql("FrmInOnlineStore.getInListDoc1");
		psta = conn.prepareStatement(sqlLovsqe);
		psta.setString(1, strlist);
		psta.setString(2, strlist);
		ResultSet rs = psta.executeQuery();
		if (rs.next()) {
			// String res = rs.getString(1);
			// if (res == null) {
			// res = strlist + "0001";
			// } else {
			// //seq = Integer.parseInt(res.substring(13, 17));
			// seq = Integer.parseInt(res.substring(17, 21));
			// }
			inListDocSeq = rs.getString("INSTOCK_SQE");
		}
		rs.close();
		psta.close();
		// return strlist + StringTool.formatDecimal(++seq, "0000");
		return inListDocSeq;
	}

	/***
	 * 保存探伤实绩(漏磁)
	 * 
	 * @return
	 */
	public CoreReturnObject saveMtResult(String detialTity, String colNo) {
		CoreReturnObject cro = new CoreReturnObject();
		Connection connection = this.getDao(CoreConstantData.sysbeanstr)
				.getConnection();
		PreparedStatement psta = null;
		String sql = "";
		ResultSet rs = null;
		Date now = new Date();
		SimpleDateFormat dateFormat = new SimpleDateFormat(
				"yyyy-MM-dd HH:mm:ss");
		String systime = dateFormat.format(now);
		try {
			connection.setAutoCommit(false); // 取消自动提交事务
			String saveMtResultSql = CoreXmlSqlParsersFactory
					.getSql("EddyCurrentTestingResult.saveMtResult");

			MilMtResultEntity detial = EntityTool.getEntityByJSONStr(
					detialTity, MilMtResultEntity.class);
			saveMtResultSql = EntityTool.fillSqlByEntity(saveMtResultSql,
					detial);
			PreparedStatement saveMtResultPsta = connection
					.prepareStatement(saveMtResultSql);
			saveMtResultPsta.executeUpdate();
			cro.setV_errMsg("保存成功!");
			connection.commit();
			try {
				String sql1 = "select count(1) cut from slm_order_head t where customer_nm like '%天津钢管%' and order_no  = \n" +
						"(\n" +
						"select order_no from Pln_Zy_Zg_m where heat_plan_no = ? and rownum =1\n" +
						")";
				psta = connection.prepareStatement(sql1);
				psta.setString(1,detial.getResultNo());
				rs = psta.executeQuery();
				if(rs.next()) {
					String string = rs.getString(1);
					if (Integer.parseInt(string) > 0) {
						//调用接口传递数据
						//根据主键id查询数据
						sql="select * from mil_mt_result t where t.result_no = ? ";
						psta = connection.prepareStatement(sql);
						psta.setString(1,detial.getResultNo());
						ResultSet rs2 = psta.executeQuery();
						// 获取结果集的元数据
						ResultSetMetaData rsmd = rs2.getMetaData();
						int columnCount = rsmd.getColumnCount();
						// 封装结果集到HashMap
						SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
						HashMap<String, Object> map = new HashMap<String, Object>();
						if (rs2.next()) {
							for (int i = 1; i <= columnCount; i++) {
								if(rs2.getObject(i) instanceof Date){//日期格式转换
									map.put(EntityTool.underlineToCamel(rsmd.getColumnName(i)), sdf.format(rs2.getObject(i)));
								}else{
									map.put(EntityTool.underlineToCamel(rsmd.getColumnName(i)), rs2.getObject(i));
								}
							}
						}
						psta.close();
						rs2.close();
						HashMap<String,Object> map1 = new HashMap<>();
						List<HashMap<String,Object>> list = new ArrayList<>();
						list.add(map);
						map1.put("milMtResults",list);
						map1.put("milEtResults",new ArrayList<>());
						HttpUrlConnectionUtil.post(UrlConfig.BASE_URL +"/v1/milresults/add",map1);
						// ps 执行日志表插入：
						psta = new LoggableStatement(connection, XsSql.InsertCxToMesLog);
						psta.setString(1, "milresults/add");
						psta.setString(2, JSONObject.fromObject(map1).toString());
						psta.setString(3, detial.getResultNo());
						psta.setString(4, "操作成功");
						psta.execute();
						connection.commit();
					}
				}
			}catch (Exception e){
				// ps 执行日志表插入：
				psta = new LoggableStatement(connection, XsSql.InsertCxToMesLog);
				psta.setString(1, "milresults/add");
				psta.setString(2, e.toString());
				psta.setString(3, detial.getResultNo());
				psta.setString(4, "操作失败");
				psta.execute();
				connection.commit();
			}finally {
				psta.close();
			}
		} catch (Exception e) {
			System.out.println(e.getMessage());
			if (connection != null) {
				try {
					cro.setV_errMsg(e.getMessage());
					connection.rollback(); // 回滚事务
				} catch (Exception e2) {
				}
			}
		} finally {
			try {
				if (connection != null && !connection.isClosed()) {
					connection.close();
				}
			} catch (Exception e2) {
			}
		}
		return cro;
	}

	/***
	 * 保存探伤实绩(涡流)
	 * 
	 * @return
	 */
	public CoreReturnObject saveEtResult(String detialTity, String colNo) {
		CoreReturnObject cro = new CoreReturnObject();
		Connection connection = this.getDao(CoreConstantData.sysbeanstr)
				.getConnection();
		PreparedStatement psta = null;
		String sql = "";
		ResultSet rs = null;
		Date now = new Date();
		SimpleDateFormat dateFormat = new SimpleDateFormat(
				"yyyy-MM-dd HH:mm:ss");
		String systime = dateFormat.format(now);
		try {
			connection.setAutoCommit(false); // 取消自动提交事务
			String saveEtResultSql = CoreXmlSqlParsersFactory
					.getSql("EddyCurrentTestingResult.saveEtResult");
			MilEtResultEntity detial = EntityTool.getEntityByJSONStr(
					detialTity, MilEtResultEntity.class);
			saveEtResultSql = EntityTool.fillSqlByEntity(saveEtResultSql,
					detial);
			PreparedStatement saveEtResultPsta = connection
					.prepareStatement(saveEtResultSql);
			saveEtResultPsta.executeUpdate();
			cro.setV_errMsg("保存成功!");
			connection.commit();
			try {
				String sql1 = "select count(1) cut from slm_order_head t where customer_nm like '%天津钢管%' and order_no  = \n" +
						"(\n" +
						"select order_no from Pln_Zy_Zg_m where heat_plan_no = ? and rownum =1\n" +
						")";
				psta = connection.prepareStatement(sql1);
				psta.setString(1,detial.getResultNo());
				rs = psta.executeQuery();
				if(rs.next()) {
					String string = rs.getString(1);
					if (Integer.parseInt(string) > 0) {
						//调用接口传递数据
						//根据主键id查询数据
						sql="select * from mil_et_result t where t.result_no = ? ";
						psta = connection.prepareStatement(sql);
						psta.setString(1,detial.getResultNo());
						ResultSet rs2 = psta.executeQuery();
						// 获取结果集的元数据
						ResultSetMetaData rsmd = rs2.getMetaData();
						int columnCount = rsmd.getColumnCount();
						// 封装结果集到HashMap
						SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
						HashMap<String, Object> map = new HashMap<String, Object>();
						if (rs2.next()) {
							for (int i = 1; i <= columnCount; i++) {
								if(rs2.getObject(i) instanceof Date){//日期格式转换
									map.put(EntityTool.underlineToCamel(rsmd.getColumnName(i)), sdf.format(rs2.getObject(i)));
								}else{
									map.put(EntityTool.underlineToCamel(rsmd.getColumnName(i)), rs2.getObject(i));
								}
							}
						}
						psta.close();
						rs2.close();
						HashMap<String,Object> map1 = new HashMap<>();
						List<HashMap<String,Object>> list = new ArrayList<>();
						list.add(map);
						map1.put("milEtResults",list);
						map1.put("milMtResults",new ArrayList<>());
						HttpUrlConnectionUtil.post(UrlConfig.BASE_URL +"/v1/milresults/add",map);
						// ps 执行日志表插入：
						psta = new LoggableStatement(connection, XsSql.InsertCxToMesLog);
						psta.setString(1, "milresults2/add");
						psta.setString(2, JSONObject.fromObject(map1).toString());
						psta.setString(3, detial.getResultNo());
						psta.setString(4, "操作成功");
						psta.execute();
						connection.commit();
					}
				}

			} catch (Exception e) {
				e.printStackTrace();
				// ps 执行日志表插入：
				psta = new LoggableStatement(connection, XsSql.InsertCxToMesLog);
				psta.setString(1, "milresults2/add");
				psta.setString(2, e.toString());
				psta.setString(3, detial.getResultNo());
				psta.setString(4, "操作失败");
				psta.execute();
				connection.commit();
			} finally {
				psta.close();
			}
		} catch (Exception e) {
			System.out.println(e.getMessage());
			if (connection != null) {
				try {
					cro.setV_errMsg(e.getMessage());
					connection.rollback(); // 回滚事务
				} catch (Exception e2) {
				}
			}
		} finally {
			try {
				if (connection != null && !connection.isClosed()) {
					connection.close();
				}
			} catch (Exception e2) {
			}
		}
		return cro;
	}

	/***
	 * 查询可疑支数
	 * 
	 * @param jugeNo
	 * @return
	 */
	public CoreReturnObject doQueryAlarm(String jugeNo, String plineCode,
			String proPlanId, String gxPlanNo) {
		String sql = "";
		if (plineCode.equals("C009") || plineCode.equals("C008")
				|| plineCode.equals("C017") || plineCode.equals("C072")) {
			sql = CoreXmlSqlParsersFactory
					.getSql("EddyCurrentTestingResult.doQueryAlarm");
		} else if (plineCode.equals("C010")) {
			sql = CoreXmlSqlParsersFactory
					.getSql("EddyCurrentTestingResult.doQueryAlarm1");
		}
		return this.getData(sql, new Object[] { jugeNo, proPlanId, gxPlanNo });
	}

	/***
	 * 查询剔除支数
	 * 
	 * @param jugeNo
	 * @return
	 */
	public CoreReturnObject doQuerySCRAPNUM(String jugeNo, String plineCode,
			String proPlanId, String gxPlanNo) {
		String sql = "";
		if (plineCode.equals("C009") || plineCode.equals("C008")
				|| plineCode.equals("C017") || plineCode.equals("C072")) {
			sql = CoreXmlSqlParsersFactory
					.getSql("EddyCurrentTestingResult.doQuerySCRAPNUM");
		} else if (plineCode.equals("C010")) {
			sql = CoreXmlSqlParsersFactory
					.getSql("EddyCurrentTestingResult.doQuerySCRAPNUM1");
		}
		return this.getData(sql, new Object[] { jugeNo, proPlanId, gxPlanNo });
	}

	/***
	 * 查询探伤实绩总支数(MT)
	 * 
	 * @param jugeNo
	 * @return
	 */
	public CoreReturnObject getMtResultNum(String jugeNo, String plineCode,
			String proPlanId, String gxPlanNo) {
		String sql = "";
		if (plineCode.equals("C009") || plineCode.equals("C008")
				|| plineCode.equals("C017") || plineCode.equals("C072")) {
			sql = CoreXmlSqlParsersFactory
					.getSql("EddyCurrentTestingResult.getMtResultNum");
		} else if (plineCode.equals("C010")) {
			sql = CoreXmlSqlParsersFactory
					.getSql("EddyCurrentTestingResult.getMtResultNum1");
		}
		return this.getData(sql, new Object[] { jugeNo, proPlanId, gxPlanNo });
	}

	/***
	 * 查询几何尺寸记录
	 * 
	 * @return
	 */
	public CoreReturnObject doQuerySize(String jugeNo, String proPlanId,
			String gxPlanNo) {
		return this.getDataBySqlID("EddyCurrentTestingResult.doQuerySize",
				new Object[] { jugeNo, proPlanId, gxPlanNo });
	}

	/***
	 * 修改切后长度
	 * 
	 * @param jugeNo
	 * @param seq
	 * @param recutLen
	 * @return
	 */
	public CoreReturnObject updateRecutLen(String jugeNo, String seq,
			String recutLen) {
		ArrayList<String> sqllist = new ArrayList<String>();
		String sql = "UPDATE MIL_TESTING_RACK T SET T.RECUT_LENGTH = '"
				+ recutLen + "' WHERE T.JUDGE_STOVE_NO = '" + jugeNo
				+ "' AND T.SEQ = '" + seq + "'";
		sqllist.add(sql);
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqllist);
	}

	/***
	 * 查询管号队列返线支数
	 * 
	 * @param resultNo
	 * @param jugeNo
	 * @return
	 */
	public CoreReturnObject selectBackLineNum(String resultNo, String jugeNo,
			String proPlanId, String gxPlanNo) {
		return this.getDataBySqlID(
				"EddyCurrentTestingResult.selectBackLineNum", new Object[] {
						resultNo, jugeNo, proPlanId, gxPlanNo });
	}

	/***
	 * 查询部分实绩
	 */
	public CoreReturnObject doQueryMtResult(String resultNo, String jugeNo) {
		return this.getDataBySqlID("EddyCurrentTestingResult.doQueryMtResult",
				new Object[] { resultNo, jugeNo });
	}

	/***
	 * 查询部分实绩
	 */
	public CoreReturnObject doQueryEtResult(String resultNo) {
		return this.getDataBySqlID("EddyCurrentTestingResult.doQueryEtResult",
				new Object[] { resultNo });
	}

	/***
	 * 查询已探伤下线支数
	 * 
	 * @return
	 */
	public CoreReturnObject doQueryTestedNum(String resultNo, String orderNo,
			String groupNo, String colNo) {
		return this.getDataBySqlID("EddyCurrentTestingResult.doQueryTestedNum",
				new Object[] { resultNo, orderNo, groupNo, colNo });
	}

	/***
	 * 查询实绩表结炉状态
	 * 
	 * @param jugeNo
	 * @param plineCode
	 * @param processNo
	 *            5-分切 6- 矫直 7-探伤 8-表检
	 * @return
	 */
	public CoreReturnObject doQueryResultStaus(String resultNo, String jugeNo,
			String plineCode, String processNo, String proPlanId,
			String gxPlanNo) {
		String sql = CoreXmlSqlParsersFactory
				.getSql("EddyCurrentTestingResult.doQueryResultStaus");
		if (processNo.equals("7")) {
			if (plineCode.equals("C009") || plineCode.equals("C008")
					|| plineCode.equals("C017") || plineCode.equals("C072")) {
				sql = sql.replace("#RESULT#", "MIL_MT_RESULT");
			} else if (plineCode.equals("C010")) {
				sql = sql.replace("#RESULT#", "MIL_ET_RESULT");
			} else {
				sql = sql.replace("#RESULT#", "MIL_UL_RESUL");
			}
		} else if (processNo.equals("6")) {
			sql = sql.replace("#RESULT#", "MIL_STRAIGHTENING_RESULT");
		} else if (processNo.equals("8")) {
			sql = sql.replace("#RESULT#", "MIL_SURFACE_RESULT");
		} else if (processNo.equals("5")) {
			sql = sql.replace("#RESULT#", "MIL_SAW_RESULT");
		}
		return this.getData(sql, new Object[] { resultNo, jugeNo, plineCode,
				proPlanId, gxPlanNo });
	}

	/***
	 * 查询下线支数
	 * 
	 * @return
	 */
	public CoreReturnObject doQueryOfflineNum(String resultNo, String colOrder,
			String colGroup, String colNo) {
		return this.getDataBySqlID(
				"EddyCurrentTestingResult.doQueryOfflineNum", new Object[] {
						resultNo, colOrder, colGroup, colNo });
	}

	/***
	 * 查询管号进程表序号
	 * 
	 * @param list
	 * @return
	 */
	public CoreReturnObject doQuerySeq(ArrayList<String> list) {
		return this
				.getDataBySqlID("EddyCurrentTestingResult.doQuerySeq",
						new Object[] { list.get(0).toString(),
								list.get(2).toString() });
	}

	/***
	 * 探伤结炉写进程表
	 * 
	 * @return
	 */
	public CoreReturnObject updateProcessTest(String JudgeStoveNo,
			String ProcessNo, String opProcessNo, ArrayList<String> parm,
			String proPlanId, String gxPlanNo, String lotNo, String plineCode) {
		CoreReturnObject cro = new CoreReturnObject();
		Connection connection = this.getDao(CoreConstantData.sysbeanstr)
				.getConnection();
		PreparedStatement psta = null;
		String sql = "";
		ResultSet rs = null;
		Date now = new Date();
		SimpleDateFormat dateFormat = new SimpleDateFormat(
				"yyyy-MM-dd HH:mm:ss");
		String systime = dateFormat.format(now);
		String m_matNo = "";
		int offNum = 0;
		String[] str = null;
		double offWgt = 0;
		String bacthNo = "X";
		String portQualifNum = ""; // 可交库支数
		String QualifNum = ""; // 已交库支数
		String lengthCp[] = null;

		String materiaNo = "";// 物料码
		String materiaName = "";// 物料描述
		String INWL_ID = "";// 投入物料编码
		String INWL_DESC = "";// 投入物料描述
		String CRAFT_SEQ = ""; // 工艺序号
		String judgeStdDes = ""; // 判定标准集合
		String cic = ""; // cic
		String offlineDoc = ""; // 离线单号

		try {
			// connection.setAutoCommit(false); // 取消自动提交事务
			String insertMatSql = CoreXmlSqlParsersFactory
					.getSql("SurfaceInspectionResult.doInsetMatData");// 已探下线入虚拟库
			PreparedStatement insertMatPsta = connection
					.prepareStatement(insertMatSql);

			sql = CoreXmlSqlParsersFactory.getSql("updateProcessL.selectScrap");
			psta = connection.prepareStatement(sql);
			psta.setString(1, JudgeStoveNo);
			psta.setString(2, ProcessNo);
			psta.setString(3, proPlanId);
			psta.setString(4, gxPlanNo);
			rs = psta.executeQuery();
			List<MilSlabScrapSeqEntity> list = EntityTool.getEntitysByRs(rs,
					MilSlabScrapSeqEntity.class);

			rs.close();
			psta.close();

			sql = CoreXmlSqlParsersFactory
					.getSql("FrmOffLine.selectMaterialNo");// 查询物料码
			psta = connection.prepareStatement(sql);
			psta.setString(1, proPlanId);
			psta.setString(2, gxPlanNo);
			rs = psta.executeQuery();
			if (rs.next()) {
				judgeStdDes = rs.getString("judgeStdDes");
				cic = rs.getString("CIC");
				materiaNo = rs.getString("OUTWL_ID");
				materiaName = rs.getString("OUTWL_DESC");
				INWL_ID = rs.getString("INWL_ID");
				INWL_DESC = rs.getString("INWL_DESC");
				CRAFT_SEQ = rs.getString("CRAFT_SEQ");
			}
			rs.close();
			psta.close();

			// 可交库支数
			sql = CoreXmlSqlParsersFactory
					.getSql("updateProcessL.SelectPortBacthSampleNum");
			psta = connection.prepareStatement(sql);
			psta.setString(1, JudgeStoveNo);
			psta.setString(2, proPlanId);
			psta.setString(3, gxPlanNo);
			rs = psta.executeQuery();
			if (rs.next()) {
				portQualifNum = rs.getString("ACTCOUNT");
			}
			rs.close();
			psta.close();

			// 已交库支数
			sql = CoreXmlSqlParsersFactory
					.getSql("updateProcessL.SelectQualifNum");
			psta = connection.prepareStatement(sql);
			psta.setString(1, JudgeStoveNo);
			psta.setString(2, proPlanId);
			psta.setString(3, gxPlanNo);
			rs = psta.executeQuery();
			if (rs.next()) {
				QualifNum = rs.getString("QUALIFIED_NUM");
			}
			rs.close();
			psta.close();
			if (QualifNum != null && !QualifNum.equals("")) {
				if (Integer.parseInt(QualifNum) > Integer
						.parseInt(portQualifNum)) {
					cro.setV_errMsg("离线/剔废支数已不足,需交库点撤回部分支数!");
					return cro;
				}
			}
			// 离线单号
			sql = CoreXmlSqlParsersFactory
					.getSql("EddyCurrentTestingResult.SelectofflineDoc");// 离线单号
			psta = connection.prepareStatement(sql);
			psta.setString(1, JudgeStoveNo);
			psta.setString(2, proPlanId);
			psta.setString(3, gxPlanNo);
			rs = psta.executeQuery();
			if (rs.next()) {
				offlineDoc = rs.getString("OFFLINE_DOC");
			}
			rs.close();
			psta.close();

			for (int i = 0; i < list.size(); i++) {
				MilSlabScrapSeqEntity milSlabSeq = list.get(i);
				String updateProcessSql = CoreXmlSqlParsersFactory
						.getSql("updateProcessL.UpdateFlag");// 结炉离线、剔除信息
				updateProcessSql = updateProcessSql.replace("#OP_PROCESS#",
						opProcessNo);
				updateProcessSql = EntityTool.fillSqlByEntity(updateProcessSql,
						milSlabSeq);
				PreparedStatement updateProcessPsta = connection
						.prepareStatement(updateProcessSql);
				updateProcessPsta.executeUpdate();
				updateProcessPsta.close();
			}

			sql = CoreXmlSqlParsersFactory
					.getSql("updateProcessL.selectSample");
			psta = connection.prepareStatement(sql);
			psta.setString(1, JudgeStoveNo);
			psta.setString(2, proPlanId);
			psta.setString(3, gxPlanNo);
			rs = psta.executeQuery();
			List<MilTestingRackEntity> listRack = EntityTool.getEntitysByRs(rs,
					MilTestingRackEntity.class);
			rs.close();
			psta.close();
			for (int j = 0; j < listRack.size(); j++) {
				MilTestingRackEntity milTestRack = listRack.get(j);
				String updateProcessSamSql = CoreXmlSqlParsersFactory
						.getSql("updateProcessSam.UpdateFlag");// 结炉写留样管信息
				updateProcessSamSql = updateProcessSamSql.replace(
						"#OP_PROCESS#", opProcessNo);
				updateProcessSamSql = EntityTool.fillSqlByEntity(
						updateProcessSamSql, milTestRack);
				PreparedStatement updateProcessSamPsta = connection
						.prepareStatement(updateProcessSamSql);
				updateProcessSamPsta.executeUpdate();
				updateProcessSamPsta.close();
			}

			sql = CoreXmlSqlParsersFactory
					.getSql("updateProcessL.selectCutLength");
			psta = connection.prepareStatement(sql);
			psta.setString(1, JudgeStoveNo);
			psta.setString(2, proPlanId);
			psta.setString(3, gxPlanNo);
			rs = psta.executeQuery();
			List<MilTestingRackEntity> listRack2 = EntityTool.getEntitysByRs(
					rs, MilTestingRackEntity.class);
			rs.close();
			psta.close();
			for (int k = 0; k < listRack2.size(); k++) {
				MilTestingRackEntity milTestRack2 = listRack2.get(k);
				String updateProcessCutLSql = CoreXmlSqlParsersFactory
						.getSql("updateProcessCutLength.UpdateFlag");// 结炉写再切长度
				updateProcessCutLSql = updateProcessCutLSql.replace(
						"#OP_PROCESS#", opProcessNo);
				updateProcessCutLSql = EntityTool.fillSqlByEntity(
						updateProcessCutLSql, milTestRack2);
				PreparedStatement updateProcessSamPsta = connection
						.prepareStatement(updateProcessCutLSql);
				updateProcessSamPsta.executeUpdate();
				updateProcessSamPsta.close();
			}
			sql = CoreXmlSqlParsersFactory
					.getSql("updateProcessTest.selectMilSlabSeqCount");
			psta = connection.prepareStatement(sql);
			psta.setString(1, JudgeStoveNo);
			psta.setString(2, proPlanId);
			psta.setString(3, gxPlanNo);
			rs = psta.executeQuery();
			if (rs.next()) {
				offNum = Integer.parseInt(rs.getString("ACOUNT"));
			}
			rs.close();
			psta.close();
			sql = CoreXmlSqlParsersFactory
					.getSql("EddyCurrentTestingResult.selectMilPlanData");// 查询炉计划信息
			psta = connection.prepareStatement(sql);
			psta.setString(1, JudgeStoveNo);
			psta.setString(2, proPlanId);
			psta.setString(3, gxPlanNo);
			rs = psta.executeQuery();
			List<MilPlanEntity3> milPlanlist = EntityTool.getEntitysByRs(rs,
					MilPlanEntity3.class);
			rs.close();
			psta.close();
			if (list == null) {
				cro.setV_errMsg("无该炉计划信息!");
				return cro;
			}
			String matNo = queryMatNoM(connection, JudgeStoveNo.replaceFirst(
					"-.*", ""), bacthNo); // 材料号
			int g = Integer.parseInt(matNo.substring(matNo.length() - 4, matNo
					.length()));
			MilPlanEntity3 milPlanTity = milPlanlist.get(0);
			str = milPlanTity.getPipeSize().split("[*]");
			lengthCp = milPlanTity.getLengthRange().split("[-]");
			offWgt = 0.02466 * Double.parseDouble(str[1])
					* (Double.parseDouble(str[0]) - Double.parseDouble(str[1]))
					* Double.parseDouble(milPlanTity.getTargetLength())
					* offNum / 1000;
			List<double[]> list1 = null;
			if (offNum > 0) {
				list1 = MeanValueCalculation.MeanCalculation(
						Double.parseDouble(new DecimalFormat("0.000")
								.format(offWgt)), offNum);
			}
			if (list1 != null) {
				for (int j = 0; j < list1.size(); j++) {
					double[] conW = list1.get(j);
					if ((int) conW[0] >= 0) {
						for (int z = 0; z < (int) conW[0]; z++) {
							insertMatPsta.setString(1, JudgeStoveNo
									.replaceFirst("-.*", ""));
							insertMatPsta.setString(2, bacthNo);
							insertMatPsta.setString(3, "001");
							insertMatPsta.setString(4, parm.get(0));
							insertMatPsta.setString(5, parm.get(1));
							insertMatPsta.setString(6, parm.get(2));
							insertMatPsta.setString(7, parm.get(3));
							insertMatPsta.setString(8, parm.get(8));
							insertMatPsta.setString(9, (JudgeStoveNo
									.replaceFirst("-.*", "") + bacthNo)
									+ StringTool.formatDecimal(g, "0000"));
							insertMatPsta.setString(10, parm.get(4));
							insertMatPsta.setString(11, parm.get(5));
							insertMatPsta.setString(12, parm.get(6));
							insertMatPsta.setString(13, parm.get(7));

							insertMatPsta.setString(14, JudgeStoveNo
									.replaceFirst("-.*", ""));
							insertMatPsta.setString(15, bacthNo);
							insertMatPsta.setString(16, "001");
							insertMatPsta.setString(17, "1");
							insertMatPsta
									.setString(18, String.valueOf(conW[1]));
							insertMatPsta.setString(19, systime);
							insertMatPsta.setString(20, (JudgeStoveNo
									.replaceFirst("-.*", "") + bacthNo)
									+ StringTool.formatDecimal(g, "0000"));
							insertMatPsta.setString(21, "801401");
							insertMatPsta.setString(22, "80150104");
							insertMatPsta.setString(23, milPlanTity
									.getPlineCode());
							insertMatPsta.setString(24, "");
							insertMatPsta.setString(25, "11");
							insertMatPsta.setString(26, milPlanTity.getId());
							insertMatPsta.setString(27, JudgeStoveNo);
							insertMatPsta.setString(28, "");
							insertMatPsta.setString(29, milPlanTity
									.getVarieties());
							insertMatPsta.setString(30, "");
							insertMatPsta.setString(31, milPlanTity
									.getSteelname());
							insertMatPsta.setString(32, "");
							insertMatPsta.setString(33, milPlanTity
									.getPipeSize());
							insertMatPsta.setString(34, "");
							insertMatPsta.setString(35, milPlanTity
									.getGradename());
							insertMatPsta.setString(36, "");
							insertMatPsta.setString(37, milPlanTity
									.getBuckleType());
							insertMatPsta.setString(38, "");
							insertMatPsta.setString(39, milPlanTity
									.getRollStandrad());
							insertMatPsta.setString(40, parm.get(6));
							insertMatPsta.setString(41, parm.get(7));
							insertMatPsta.setString(42, milPlanTity
									.getStdStyle());
							insertMatPsta.setString(43, milPlanTity
									.getStdStyleDesc());
							insertMatPsta.setString(44, str[0].toString());
							insertMatPsta.setString(45, str[1].toString());
							insertMatPsta.setString(46, lengthCp[0].toString());
							insertMatPsta.setString(47, lengthCp[1].toString());
							insertMatPsta.setString(48, milPlanTity.getLotNo());
							insertMatPsta.setString(49, milPlanTity
									.getContractNo());
							insertMatPsta.setString(50, milPlanTity
									.getTargetLength());
							insertMatPsta
									.setString(51, milPlanTity.getTarget());
							insertMatPsta.setString(52, milPlanTity
									.getProcessStatus());
							insertMatPsta.setString(53, JudgeStoveNo
									.replaceFirst("-.*", ""));
							insertMatPsta.setString(54, proPlanId);
							insertMatPsta.setString(55, gxPlanNo);

							insertMatPsta.setString(56, materiaNo);
							insertMatPsta.setString(57, materiaName);
							insertMatPsta.setString(58, INWL_ID);
							insertMatPsta.setString(59, INWL_DESC);
							insertMatPsta.setString(60, cic);
							insertMatPsta.setString(61, judgeStdDes);
							insertMatPsta.setString(62, CRAFT_SEQ);
							insertMatPsta.setString(63, offlineDoc); // 离线单号
							insertMatPsta.addBatch();
							g++;
						}
					}
				}
			}
			// insertMatPsta.executeBatch();

			String insertMatScrapSql = CoreXmlSqlParsersFactory
					.getSql("FrmOffLine.insertMatScrap"); // 废品入半成品库存
			PreparedStatement insertMatScrapPsta = connection
					.prepareStatement(insertMatScrapSql);
			insertMatScrapPsta.setString(1, JudgeStoveNo);
			insertMatScrapPsta.setString(2, proPlanId);
			insertMatScrapPsta.setString(3, gxPlanNo);
			insertMatScrapPsta.setString(4, plineCode);
			insertMatScrapPsta.setString(5, ProcessNo);
			insertMatScrapPsta.addBatch();

			insertMatScrapPsta.executeBatch();

			cro.setV_errMsg("修改成功!");
			connection.commit();

		} catch (Exception e) {
			System.out.println(e.getMessage());
			if (connection != null) {
				try {
					cro.setV_errMsg(e.getMessage());
					connection.rollback(); // 回滚事务
				} catch (Exception e2) {
				}
			}
		} finally {
			try {
				if (connection != null && !connection.isClosed()) {
					connection.close();
				}
			} catch (Exception e2) {
			}
		}
		return cro;
	}

	/***
	 * 结炉回退删除虚拟库存
	 * 
	 * @param JudgeStoveNo
	 * @return
	 */
	public CoreReturnObject doDeleteMatData(String JudgeStoveNo,
			String proPlanId, String gxPlanNo, String plineCode) {
		CoreReturnObject cro = new CoreReturnObject();
		Connection connection = this.getDao(CoreConstantData.sysbeanstr)
				.getConnection();
		PreparedStatement psta = null;
		String sql = "";
		ResultSet rs = null;
		int offNum = 0;
		try {
			connection.setAutoCommit(false); // 取消自动提交事务
			String deleteMatSql = CoreXmlSqlParsersFactory
					.getSql("SurfaceInspectionResult.doDeleteMatData");// 删除虚拟库存
			PreparedStatement deleteMatPsta = connection
					.prepareStatement(deleteMatSql);
			String deleteSlabScrap = CoreXmlSqlParsersFactory
					.getSql("SurfaceInspectionResult.doDeleteSlabScrap");
			PreparedStatement deleteSlabPsta = connection
					.prepareStatement(deleteSlabScrap);
			sql = CoreXmlSqlParsersFactory
					.getSql("updateProcessTest.selectMilSlabSeqCount");
			psta = connection.prepareStatement(sql);
			psta.setString(1, JudgeStoveNo);
			psta.setString(2, proPlanId);
			psta.setString(3, gxPlanNo);
			rs = psta.executeQuery();
			if (rs.next()) {
				offNum = Integer.parseInt(rs.getString("ACOUNT"));
			}
			rs.close();
			psta.close();

			deleteMatPsta.setString(1, JudgeStoveNo);
			deleteMatPsta.setInt(2, offNum);
			deleteMatPsta.addBatch();

			deleteSlabPsta.setString(1, JudgeStoveNo);
			deleteSlabPsta.setString(2, proPlanId);
			deleteSlabPsta.setString(3, gxPlanNo);
			deleteSlabPsta.addBatch();

			String insertMatScrapSql = CoreXmlSqlParsersFactory
					.getSql("FrmOffLine.insertMatScrapBack"); // 废品入半成品库存回退
			PreparedStatement insertMatScrapPsta = connection
					.prepareStatement(insertMatScrapSql);
			insertMatScrapPsta.setString(1, JudgeStoveNo);
			insertMatScrapPsta.setString(2, proPlanId);
			insertMatScrapPsta.setString(3, gxPlanNo);
			insertMatScrapPsta.setString(4, plineCode);
			// insertMatScrapPsta.setString(5, "10");
			insertMatScrapPsta.addBatch();

			deleteMatPsta.executeBatch();
			deleteSlabPsta.executeBatch();
			insertMatScrapPsta.executeBatch();
			cro.setV_errMsg("删除成功!");
			connection.commit();
		} catch (Exception e) {
			System.out.println(e.getMessage());
			if (connection != null) {
				try {
					cro.setV_errMsg(e.getMessage());
					connection.rollback(); // 回滚事务
				} catch (Exception e2) {
				}
			}
		} finally {
			try {
				if (connection != null && !connection.isClosed()) {
					connection.close();
				}
			} catch (Exception e2) {
			}
		}
		return cro;
	}

	/**
	 * 根据炉号、批号自动生成材料号
	 * 
	 * @param conn
	 *            c
	 * @param strLcode
	 *            传递参数
	 * @return obj
	 * @throws Exception
	 *             异常处理
	 */
	public String queryMatNoM(Connection conn, String strLcode, String strBatch)
			throws Exception {
		int count = 0;
		String matNo = "";
		PreparedStatement psta = null;
		String sqlLovsqe = CoreXmlSqlParsersFactory
				.getSql("FrmInOnlineStore.queryMatNoM");
		psta = conn.prepareStatement(sqlLovsqe);
		psta.setString(1, strLcode);
		psta.setString(2, strBatch);
		psta.setString(3, strLcode);
		psta.setString(4, strBatch);
		psta.setString(5, strLcode);
		psta.setString(6, strBatch);
		psta.setString(7, strLcode);
		psta.setString(8, strBatch);
		ResultSet rs = psta.executeQuery();
		if (rs.next()) {
			matNo = rs.getString("MAT_NO");
		}
		rs.close();
		psta.close();
		// return (strLcode + strBatch)
		// + StringTool.formatDecimal(++count, "0000");
		return matNo;
	}

	/***
	 * 查询该炉有被组炉的
	 * 
	 * @return
	 */
	public CoreReturnObject selectMilOfflineGroup(String jugeNo,
			String proPlanId, String gxPlanNo) {
		return this.getDataBySqlID(
				"EddyCurrentTestingResult.selectMilOfflineGroup", new Object[] {
						jugeNo, proPlanId, gxPlanNo });
	}

	/***
	 * 复制材料号
	 * 
	 * @param jugeNo
	 * @param ProcessNo
	 * @return
	 */
	public CoreReturnObject assignmentMatNo(String jugeNo, String ProcessNo,
			String plineCode, String proPlanId, String gxPlanNo) {
		CoreReturnObject cro = new CoreReturnObject();
		Connection connection = this.getDao(CoreConstantData.sysbeanstr)
				.getConnection();
		PreparedStatement psta = null;
		String sql = "";
		ResultSet rs = null;
		Date now = new Date();
		SimpleDateFormat dateFormat = new SimpleDateFormat(
				"yyyy-MM-dd HH:mm:ss");
		String systime = dateFormat.format(now);
		try {
			connection.setAutoCommit(false); // 取消自动提交事务
			String insertScrapSql = CoreXmlSqlParsersFactory
					.getSql("EddyCurrentTestingResult.insertScrapSlab");
			String updateMatNoSql = CoreXmlSqlParsersFactory
					.getSql("EddyCurrentTestingResult.assignmentMatNo");
			PreparedStatement updateMatNoPsta = connection
					.prepareStatement(updateMatNoSql);
			PreparedStatement insertScrapPsta = connection
					.prepareStatement(insertScrapSql);
			updateMatNoPsta.setString(1, jugeNo);
			updateMatNoPsta.setString(2, proPlanId);
			updateMatNoPsta.setString(3, gxPlanNo);
			updateMatNoPsta.setString(4, jugeNo);
			updateMatNoPsta.setString(5, proPlanId);
			updateMatNoPsta.setString(6, gxPlanNo);
			updateMatNoPsta.addBatch();

			insertScrapPsta.setString(1, jugeNo);
			insertScrapPsta.setString(2, proPlanId);
			insertScrapPsta.setString(3, gxPlanNo);
			insertScrapPsta.setString(4, plineCode);
			insertScrapPsta.setString(5, proPlanId);
			insertScrapPsta.setString(6, gxPlanNo);
			insertScrapPsta.addBatch();
			insertScrapPsta.executeBatch();
			updateMatNoPsta.executeBatch();
			cro.setV_errMsg("修改成功!");
			connection.commit();
		} catch (Exception e) {
			System.out.println(e.getMessage());
			if (connection != null) {
				try {
					cro.setV_errMsg(e.getMessage());
					connection.rollback(); // 回滚事务
				} catch (Exception e2) {
				}
			}
		} finally {
			try {
				if (connection != null && !connection.isClosed()) {
					connection.close();
				}
			} catch (Exception e2) {
			}
		}
		return cro;
	}

	/***
	 * 查询绑定操作者等级
	 * 
	 * @param list
	 * @return
	 */
	public CoreReturnObject doQueryGrade(ArrayList<String> list) {
		return this.getDataBySqlID("EddyCurrentTestingResult.doQueryGrade",
				list.toArray());
	}

	/***
	 * 查询绑定签发者
	 * 
	 * @param list
	 * @return
	 */
	public CoreReturnObject doQueryGrade2(ArrayList<String> list) {
		return this.getDataBySqlID("EddyCurrentTestingResult.doQueryGrade2",
				list.toArray());
	}
	public CoreReturnObject doQueryGradejd(ArrayList<String> list) {
		return this.getDataBySqlID("EddyCurrentTestingResult.doQueryGradejd",
				list.toArray());
	}

	public CoreReturnObject doQueryGrade1(String userid) {
		return this.getDataBySqlID("EddyCurrentTestingResult.doQueryGrade1",
				new Object[] { userid });
	}
}
