package com.steering.pss.judge.DAL;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;

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

import com.steering.comm.db.DBCommon;
import com.steering.comm.tools.EntityTool;
import com.steering.pss.judge.model.YdmZcOutlistEntity;
import com.steering.pss.qcm.model.QcmJyThreadReportEntity;
public class QcmJyThreadReport extends DBCommon {
	
	/**
	 * 查询Items项目列
	 * @return
	 */
	public CoreReturnObject FindItemsList(){
		String sql = CoreXmlSqlParsersFactory.getSql("QcmJyQueryFrm.FindItemsList");
		return this.getData(sql);
	}
	
	/**
	 * 查询螺纹检验报告
	 * @return
	 */
	public CoreReturnObject FindThreadReport(ArrayList<Object> params){
		String sql = CoreXmlSqlParsersFactory
				.getSql("QcmJyThreadReport.FindThreadReport");
		if (!params.get(0).equals("")) {
			sql += " and ORDER_NO = '" + params.get(0) + "'";
		}
		return this.getData(sql);
	}
	/**
	 * 增加
	 */
	public CoreReturnObject AddThreadReport(ArrayList<String> parmList){
		 ArrayList<String> sqllist = new ArrayList<String>();
		 for(String str : parmList)
			{
			 
			 QcmJyThreadReportEntity threadEntity = EntityTool.getEntityByJSONStr(str, QcmJyThreadReportEntity.class);

				String sql = CoreXmlSqlParsersFactory.getSql("QcmJyThreadReport.AddThreadReport");//增加
				String addsql = EntityTool.fillSqlByEntity(sql, threadEntity);
				sqllist.add(addsql);
			}
		return  this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(sqllist);
	}


	//修改
	public CoreReturnObject UpdateThreadReport(ArrayList<String> parmList){
		 ArrayList<String> sqllist = new ArrayList<String>();
		 for(String str : parmList)
			{
			 
			 QcmJyThreadReportEntity threadEntity = EntityTool.getEntityByJSONStr(str, QcmJyThreadReportEntity.class);

				String sql = CoreXmlSqlParsersFactory.getSql("QcmJyThreadReport.UpdateThreadReport");//修改
				String addsql = EntityTool.fillSqlByEntity(sql, threadEntity);
				sqllist.add(addsql);
			}
		 return  this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(sqllist);
	}
	
	/**
	 * 根据合同号删除螺纹检验报告记录
	 * @param pram
	 * @return
	 */
	public CoreReturnObject deleteThreadReport(ArrayList<ArrayList<String>> pram) {
		ArrayList<String> sqllist = new ArrayList<String>();
		ArrayList<Object[]> parmlist = new ArrayList<Object[]>();
		for (int i = 0; i < pram.size(); i++) {
			sqllist.add(CoreXmlSqlParsersFactory.getSql("QcmJyThreadReport.deleteThreadReport"));
			parmlist.add(pram.get(i).toArray());
		}
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(sqllist, parmlist); // 执行事务处理（多个非查询， 自动提交、回滚）
	}

	
	
	
}
