<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="接箍车丝作业实绩">

	<query id="CoupThreadingService.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="CoupThreadingService.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 in (?)
		    
        ]]>
	</query>
	
	<query id="CoupThreadingService.ProcessPlan.GetThreadingSelfcheck" desc="查询自检记录">
        <![CDATA[
         select t.SEQ_NO,t.lead,t.height,t.taper,t.pitch_dimeter,t.plan_no 
         from COUPLING_THREADING_SELFCHECK t
		  WHERE t.plan_no =? order by t.SEQ_NO
		    
        ]]>
	</query>
	
	<query id="CoupThreadingService.ProcessPlan.GetThreadingSelfcheckByPlan" desc="查询某一个自检记录">
        <![CDATA[
         select t.SEQ_NO,t.lead,t.height,t.taper,t.pitch_dimeter,t.plan_no 
         from COUPLING_THREADING_SELFCHECK t
		  WHERE t.plan_no =? and t.SEQ_NO=?
		    
        ]]>
	</query>
	
	<query id="CoupThreadingService.ProcessPlan.AddThreadingSelfcheck" desc="新增自检记录">
        <![CDATA[
         INSERT INTO COUPLING_THREADING_SELFCHECK
                    (lead,
                    height,
                    taper,
                    pitch_dimeter,
                    plan_no,
                    SEQ_NO)
            VALUES
                   (?,
                    ?,
                    ?,
                    ?,
                    ?,
                    ?)
		    
        ]]>
	</query>
	
	<query id="CoupThreadingService.ProcessPlan.UpdateThreadingSelfcheck" desc="修改自检记录">
		<![CDATA[
			 UPDATE COUPLING_THREADING_SELFCHECK set
							lead=?, 
							height=?,
							taper=?,
							pitch_dimeter=?
							WHERE PLAN_NO =? and SEQ_NO=?
		]]>
	</query>
	
	<query id="CoupThreadingService.ProcessPlan.GetThreadingResultAndCoupPlan" desc="作业计划和实绩查询">
        <![CDATA[
         SELECT T.PLINE_NAME, T.LOT_NO,  T.HEAT_NO, T.BATCH_NO,T.IF_MONITOR_JG,
         T.PLAN_TIME,T.PLAN_USETIME,
        	C.MACHINE_NO,
         		C.PRODUCED_PCS,
                C.QUALIRIED_PCS,
                    C.REJECTED_PCS,
                    C.REJECTED_REASON,
                    C.PRODUCER,
                    C.PRODUCER_TIME,
                    C.COL_SHIFT,
                    C.COL_GROUP,
                    C.COL_USER,
                    C.COL_TIME
		   FROM PLN_ZY_JG_PROCESS T,COUPLING_THREADING_RESULT C
		  WHERE T.COUPCUT_BATCH_ID =?
		  and C.PLAN_NO = T.COUPCUT_BATCH_ID
		    
        ]]>
	</query>

	
	<query id="CoupThreadingService.ProcessPlan.GetThreadingResult" desc="根据计划号查询车丝实绩">
        <![CDATA[
         SELECT MACHINE_NO,
         		PRODUCED_PCS,
                QUALIRIED_PCS,
                    REJECTED_PCS,
                    REJECTED_REASON,
                    PRODUCER,
                    PRODUCER_TIME,
                    COL_SHIFT,
                    COL_GROUP,
                    COL_USER,
                    COL_TIME
		   FROM COUPLING_THREADING_RESULT
		  WHERE PLAN_NO = ?
		    
        ]]>
	</query>
	
	<query id="CoupThreadingService.ProcessPlan.UpdateThreadingResult" desc="修改">
		<![CDATA[
			 UPDATE COUPLING_THREADING_RESULT set
							MACHINE_NO=?, 
							PRODUCED_PCS=?, 
							QUALIRIED_PCS=?,
							REJECTED_PCS=?,
							REJECTED_REASON=?,
							PRODUCER=?,
							PRODUCER_TIME=TO_DATE(?, 'yyyy-mm-dd hh24:mi:ss'),
							COL_SHIFT=?,
                    		COL_GROUP=?,
                    		COL_USER=?,
                    		COL_TIME=TO_DATE(?, 'yyyy-mm-dd hh24:mi:ss'),
                    		PLINE_CODE=?
							WHERE PLAN_NO =?
		]]>
	</query>
	
	<query id="CoupThreadingService.ProcessPlan.AddThreadingResult" desc="新增车丝实绩">
        <![CDATA[
         INSERT INTO COUPLING_THREADING_RESULT
                    (RESULT_NO,
                    MACHINE_NO,
                    PRODUCED_PCS,
                    QUALIRIED_PCS,
                    REJECTED_PCS,
                    REJECTED_REASON,
                    PRODUCER,
                    PRODUCER_TIME,
                    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'),
                    ?,
                    ?,
                    ?,
                    TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),
                    ?,
                    ?)
		    
        ]]>
	</query>
</queryMap>