<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="接箍切割作业实绩">
	<query id="CoupCutService.CutPlan.SingleQuery" desc="作业计划简单查询">
		<!--  SELECT T.JG_CUT_PLN_ID, T.JGBATCH_ID, T.BATCH_SEQ, T.HEATNO, T.PLINE_CODE
		   FROM PLN_ZY_JG_CUT 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.JGBATCH_ID || '&' LIKE '%' || ? || '%'
		    AND T.HEATNO || '&' LIKE '%' || ? || '%' -->
        <![CDATA[
         SELECT T.COUPCUT_BATCH_ID, T.BATCH_NO, T.JUDGE_STOVE_NO,T.PLANSTATUS, T.PLINE_CODE, T.PLINE_NAME
		   FROM PLN_ZY_JG_CUT 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.JUDGE_STOVE_NO || '&' LIKE '%' || ? || '%'
		    AND T.BATCH_NO || '&' LIKE '%' || ? || '%'
		    
        ]]>
	</query>
	
	
	<query id="CoupCutService.CutPlan.CoupPlan" desc="作业计划查询">
        <![CDATA[
        SELECT T.PLINE_CODE,T.PLINE_NAME,T.JUDGE_STOVE_NO,T.BATCH_NO,'是否监制',
				T.PLAN_TIME,T.PLAN_USETIME,T.GROUP_CUT,'备注',
				T.WL_ID_IN,T.JGBL_NUM,T.JGBL_WEIGHT
				FROM PLN_ZY_JG_CUT T
		  WHERE T.COUPCUT_BATCH_ID =?
		    
        ]]>
	</query>
	
	<query id="CoupCutService.CutPlan.GetCutResultAndCoupPlan" desc="作业计划和实绩查询">
        <![CDATA[
         SELECT T.PLINE_CODE,T.PLINE_NAME,T.JUDGE_STOVE_NO,T.BATCH_NO,'是否监制',
		        T.PLAN_TIME,T.PLAN_USETIME,T.GROUP_CUT,'备注',
		        T.WL_ID_IN,T.JGBL_NUM,T.JGBL_WEIGHT,
         C.MACHINE_NO,
         		C.CUT_PIECES,
                C.QUALIFIED_NUMBER,
                    C.REJECTED_PCS,
                    C.REJECTED_REASON,
                    decode(C.IS_REMAINING,0,'false','true'),
                    C.LVALID_LENGTH,
                    C.PRODUCER,
                    C.PRODUCER_TIME,
                    C.COL_SHIFT,
                    C.COL_GROUP,
                    C.COL_USER,
                    C.COL_TIME
		   FROM PLN_ZY_JG_CUT T,COUPLING_CUT_RESULT C
		  WHERE T.COUPCUT_BATCH_ID =?
		  and C.PLAN_NO = T.COUPCUT_BATCH_ID
		    
        ]]>
	</query>
	 
	
	<query id="CoupCutService.CutPlan.SelectPipeNO" desc="查询单个作业计划的管号队列">
        <![CDATA[
         SELECT T.MAT_NO,T.PRODUCNAME,T.ORDER_NO,T.ORDER_SEQ,T.JUDGE_STOVE_NO,
         T.LOT_NO,T.PLINE_CODE
		   FROM MAT_BC_M  T
		  WHERE T.MAT_STATUS = 33 and
		  T.JUDGE_STOVE_NO = ? and T.Batch_No =?
		    
        ]]>
	</query>
	<!-- update MAT_BC_M t 
        set t.mat_status = 1 
        where t.plan_no = ? and 
        t.mat_status = 0 and 
        rownum <= ? -->
	<query id="CoupCutService.CutPlan.UpdatePipeNO" desc="更新单个作业计划的管号队列">
        <![CDATA[
        update MAT_BC_M t set t.mat_status = 34 
        where t.plan_no = ? and 
        rownum <= ? 
		    
        ]]>
	</query>
	
	<query id="CoupCutService.CutPlan.RetrunPipeNO" desc="还原管号队列状态">
        <![CDATA[
        update MAT_BC_M t set t.mat_status = 33 
        where t.plan_no = ?    
        ]]>
	</query>
	
	<query id="CoupCutService.CutPlan.GetCutResultByPlanNo" desc="根据计划号查询切割实绩">
        <![CDATA[
         SELECT MACHINE_NO,
         		CUT_PIECES,
                QUALIFIED_NUMBER,
                    REJECTED_PCS,
                    REJECTED_REASON,
                    decode(IS_REMAINING,0,'false','true'),
                    LVALID_LENGTH,
                    PRODUCER,
                    PRODUCER_TIME,
                    COL_SHIFT,
                    COL_GROUP,
                    COL_USER,
                    COL_TIME
		   FROM COUPLING_CUT_RESULT
		  WHERE PLAN_NO = ?
		    
        ]]>
	</query>
	
	<query id="CoupCutService.CutPlan.UpdateCutResult" desc="修改">
		<![CDATA[
			 UPDATE COUPLING_CUT_RESULT set
							MACHINE_NO=?, 
							CUT_PIECES=?, 
							QUALIFIED_NUMBER=?,
							REJECTED_PCS=?,
							REJECTED_REASON=?,
							IS_REMAINING=decode(?,'False','0','1'),
							LVALID_LENGTH=?,
							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="CoupCutService.CutPlan.AddCutResult" desc="新增切割实绩">
        <![CDATA[
         INSERT INTO COUPLING_CUT_RESULT
                    (RESULT_NO,
                    MACHINE_NO,
                    CUT_PIECES,
                    QUALIFIED_NUMBER,
                    REJECTED_PCS,
                    REJECTED_REASON,
                    IS_REMAINING,
                    LVALID_LENGTH,
                    PRODUCER,
                    PRODUCER_TIME,
                    COL_SHIFT,
                    COL_GROUP,
                    COL_USER,
                    COL_TIME,
                    PLINE_CODE,
                    PLAN_NO)
            VALUES
                   (COUPLING_RESULT_SEQUENCE.Nextval,
                   	?,
                    ?,
                    ?,
                    ?,
                    ?,
                    decode(?,'False','0','1'),
                    ?,
                    ?,
                    TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),
                    ?,
                    ?,
                    ?,
                    TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),
                    ?,
                    ?)
		    
        ]]>
	</query>
</queryMap>