<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc=" 螺纹检验实绩">

	<query id="ThreadInspectResultService.ProcessPlan.SingleQuery" desc="作业计划简单查询">
        <![CDATA[
         SELECT T.COUPCUT_BATCH_ID, T.HEAT_NO, T.BATCH_NO, T.PLANSTATUS,T.PLINE_CODE
		   FROM PLN_ZY_JG_PROCESS T
		  WHERE T.PLAN_TIME BETWEEN TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS') AND
		        TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')
		    AND T.LOT_NO || '&' LIKE '%' || ? || '%'
		    AND T.HEAT_NO || '&' LIKE '%' || ? || '%'
		    AND T.BATCH_NO || '&' LIKE '%' || ? || '%'
		    
        ]]>
	</query>
	
	
	<query id="ThreadInspectResultService.ProcessPlan.CoupProcessPlan" desc="作业计划查询">
        <![CDATA[
         SELECT T.PLINE_CODE, T.LOT_NO,  T.HEAT_NO, T.BATCH_NO,T.IF_MONITOR_JG,
         T.PLAN_TIME,T.PLAN_USETIME
		   FROM PLN_ZY_JG_PROCESS T
		  WHERE T.COUPCUT_BATCH_ID =?
		    
        ]]>
	</query>
	
	<query id="ThreadInspectResultService.ProcessPlan.GetThreadingSelfcheck" desc="查询自检记录">
        <![CDATA[
         select T.SEQ_NO,T.TAPER,T.LEAD,T.HEIGHT,T.PDIAMETER_OVALITY,T.BROKENTHREAD,
				T.AL,T.RUN_OUT,T.CHAMFER,T.THREADFORM,T.RESULT
				from COUPLING_INSPECT_SELFCHECK T
				WHERE T.PLAN_NO = ?
		    
        ]]>
	</query>
	
	<query id="ThreadInspectResultService.ProcessPlan.GetThreadingSelfcheckBySeq" desc="查询某一个自检记录">
        <![CDATA[
         select T.SEQ_NO,T.TAPER,T.LEAD,T.HEIGHT,T.PDIAMETER_OVALITY,T.BROKENTHREAD,
				T.AL,T.RUN_OUT,T.CHAMFER,T.THREADFORM,T.RESULT
				from COUPLING_INSPECT_SELFCHECK T
				WHERE T.PLAN_NO = ? and T.SEQ_NO =?
		    
        ]]>
	</query>
	
	<query id="ThreadInspectResultService.ProcessPlan.AddThreadingSelfcheck" desc="新增自检记录">
        <![CDATA[
         INSERT INTO COUPLING_INSPECT_SELFCHECK
                    (TAPER,
                    LEAD,
                    HEIGHT,
                    PDIAMETER_OVALITY,
                    BROKENTHREAD,
                    AL,
                    RUN_OUT,
                    CHAMFER,
                    THREADFORM,
                    RESULT,
                    PLAN_NO,
                    SEQ_NO)
            VALUES
                   (?,
                    ?,
                    ?,
                    ?,
                    ?,
                    ?,
                    ?,
                    ?,
                    ?,
                    ?,
                    ?,
                    ?)   
        ]]>
	</query>
	
	
	<query id="ThreadInspectResultService.ProcessPlan.UpdateThreadingSelfcheck" desc="修改自检记录">
        <![CDATA[
         UPDATE COUPLING_INSPECT_SELFCHECK set
                    TAPER=?,
                    LEAD=?,
                    HEIGHT=?,
                    PDIAMETER_OVALITY=?,
                    BROKENTHREAD=?,
                    AL=?,
                    RUN_OUT=?,
                    CHAMFER=?,
                    THREADFORM=?,
                    RESULT=?
                   	WHERE PLAN_NO=? AND SEQ_NO=?
        ]]>
	</query>
	
	<query id="ThreadInspectResultService.ProcessPlan.GetThreadingResultAndCoupPlan" desc="作业计划和实绩查询">
        <![CDATA[
         SELECT T.PLINE_CODE, T.LOT_NO,  T.HEAT_NO, T.BATCH_NO,T.IF_MONITOR_JG,
         T.PLAN_TIME,T.PLAN_USETIME,
         	C.INSPECT_PIECES,
        	C.QUALIRIED_PCS,
                C.REPAIRED_PCS,
                    C.REPAIRED_REASON1,
                    C.REPAIRED_PCS1,
                   C.REPAIRED_REASON2,
                    C.REPAIRED_PCS2,
                    C.REPAIRED_REASON3,
                    C.REPAIRED_PCS3,
                    C.REPAIRED_REASON4,
                    C.REPAIRED_PCS4,
                    C.COL_SHIFT,
                    C.COL_GROUP,
                    C.COL_USER,
                    C.COL_TIME
		   FROM PLN_ZY_JG_PROCESS T,COUPLING_THINSPECT_RESULT C
		  WHERE T.COUPCUT_BATCH_ID =?
		  and C.PLAN_NO = T.COUPCUT_BATCH_ID
		    
        ]]>
	</query>

	
	<query id="ThreadInspectResultService.ProcessPlan.GetThreadInspectResult" desc="根据计划号查询螺纹检验实绩">
        <![CDATA[
         SELECT INSPECT_PIECES,
         		QUALIRIED_PCS,
                REPAIRED_PCS,
                    REPAIRED_REASON1,
                    REPAIRED_PCS1,
                   REPAIRED_REASON2,
                    REPAIRED_PCS2,
                    REPAIRED_REASON3,
                    REPAIRED_PCS3,
                    REPAIRED_REASON4,
                    REPAIRED_PCS4,
                    COL_SHIFT,
                    COL_GROUP,
                    COL_USER,
                    COL_TIME
		   FROM COUPLING_THINSPECT_RESULT
		  WHERE PLAN_NO = ?
		    
        ]]>
	</query>
	
	<query id="ThreadInspectResultService.ProcessPlan.UpdateThreadInspectResult" desc="修改">
		<![CDATA[
			 UPDATE COUPLING_THINSPECT_RESULT set
							INSPECT_PIECES=?, 
							QUALIRIED_PCS=?,
							REPAIRED_PCS=?,
							REPAIRED_REASON1=?,
                    		REPAIRED_PCS1=?,
                   			REPAIRED_REASON2=?,
                    		REPAIRED_PCS2=?,
                    		REPAIRED_REASON3=?,
                    		REPAIRED_PCS3=?,
                    		REPAIRED_REASON4=?,
                    		REPAIRED_PCS4=?,
							COL_SHIFT=?,
                    		COL_GROUP=?,
                    		COL_USER=?,
                    		COL_TIME=TO_DATE(?, 'yyyy-mm-dd hh24:mi:ss'),
                    		PLINE_CODE=?
							WHERE PLAN_NO =?
		]]>
	</query>
	
	<query id="ThreadInspectResultService.ProcessPlan.AddThreadInspectResult" desc="新增螺纹检验实绩">
        <![CDATA[
         INSERT INTO COUPLING_THINSPECT_RESULT
                    (RESULT_NO,
                    INSPECT_PIECES,
         			QUALIRIED_PCS,
                	REPAIRED_PCS,
                    REPAIRED_REASON1,
                    REPAIRED_PCS1,
                   	REPAIRED_REASON2,
                    REPAIRED_PCS2,
                    REPAIRED_REASON3,
                    REPAIRED_PCS3,
                    REPAIRED_REASON4,
                    REPAIRED_PCS4,
                    COL_SHIFT,
                    COL_GROUP,
                    COL_USER,
                    COL_TIME,
                    PLINE_CODE,
                    PLAN_NO)
            VALUES
                   (COUPLING_RESULT_SEQUENCE.Nextval,
                   	?,
                    ?,
                    ?,
                    ?,
                   	?,
                    ?,
                    ?,
                    ?,
                    ?,
                    ?,
                    ?,
                    ?,
                    ?,
                    ?,
                    TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),
                    ?,
                    ?)
		    
        ]]>
	</query>
</queryMap>