<?xml version="1.0" encoding="UTF-8"?>
<queryMap>
<query id = "FrmMatResume.doQuery" desc = "查询">
SELECT T1.ORDER_NO,
       T1.ORDER_SEQ,
       T1.ORDER_SEQ_NO,
       T1.PRODUCT_FLAG,
       T1.MAT_STATUS,
       T1.JUDGE_STOVE_NO,
       T1.BATCH_NO,
       T1.BATCH_GROUD_NO,
       T1.EVENT_ID,
       T1.EVENT_DESC,
       T1.FORM_NAME,
       T1.CALL_FUNC_CODING,
       T1.MATERIAL_NO,
       T1.MATERIAL_NAME,
       T1.PRODUCCODE,
       T1.PRODUCNAME,
       T1.STEELCODE,
       T1.STEELNAME,
       T1.STD_CODE,
       T1.STD_NAME,
       T1.STD_STYLE,
       T1.STD_STYLE_DESC,
       T1.SPEC_CODE,
       T1.SPEC_NAME,
       T1.MODEL_CODE,
       T1.MODEL_DESC,
       SUM(NVL(T1.ACT_LEN, 0)) ACT_LEN,
       T1.ACT_LEN_MIN,
       T1.ACT_LEN_MAX,
       SUM(NVL(T1.ACT_COUNT, 0)) ACT_COUNT,
       SUM(NVL(T1.ACT_WEIGHT, 0)) ACT_WEIGHT,
       SUM(NVL(T1.ACT_THEORY_WEIGHT, 0)) ACT_THEORY_WEIGHT,
       T1.OLD_ORDER_NO,
       T1.OLD_ORDER_SEQ,
       T1.OLD_ORDER_SEQ_NO,
       T1.BELONG_CODE,
       T1.BELONG_NAME,
       T1.MEMO,
       T1.CREATE_NAME,
       T1.CREATE_TIME,
       T1.DEPARTMENT_CODE,
       T1.DEPARTMENT_DESC,
       T1.MANAGEMENT_NO,
       T1.MANAGEMENT_NAME,
       T1.FILL_QUANTITY_FLAG,
       T1.PRO_NO,
       T1.FINISHPRO_MOLD,
       T1.IN_MOLD,MIN(T1.IN_TIME_F) IN_TIME_F
  FROM (SELECT T.ORDER_NO,
               T.ORDER_SEQ,
               T.ORDER_SEQ_NO,
               T.PRODUCT_FLAG,
               T.MAT_STATUS,
               T.JUDGE_STOVE_NO,
               T.BATCH_NO,
               T.BATCH_GROUD_NO,
               T.EVENT_ID,
               T.EVENT_DESC,
               T.FORM_NAME,
               T.CALL_FUNC_CODING,
               T.MATERIAL_NO,
               T.MATERIAL_NAME,
               T.PRODUCCODE,
               T.PRODUCNAME,
               T.STEELCODE,
               T.STEELNAME,
               T.STD_CODE,
               T.STD_NAME,
               T.STD_STYLE,
               T.STD_STYLE_DESC,
               T.SPEC_CODE,
               T.SPEC_NAME,
               T.MODEL_CODE,
               T.MODEL_DESC,
               T.ACT_LEN,
               T.ACT_LEN_MIN,
               T.ACT_LEN_MAX,
               T.ACT_COUNT,
               T.ACT_WEIGHT,
               T.ACT_THEORY_WEIGHT,
               T.OLD_ORDER_NO,
               T.OLD_ORDER_SEQ,
               T.OLD_ORDER_SEQ_NO,
               T.BELONG_CODE,
               T.BELONG_NAME,
               T.MEMO,
               T.CREATE_NAME,
               TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD') CREATE_TIME,
               T.DEPARTMENT_CODE,
               T.DEPARTMENT_DESC,
               T.MANAGEMENT_NO,
               T.MANAGEMENT_NAME,
               DECODE(T.FILL_QUANTITY_FLAG, '0', '未补量', '1', '已补量') FILL_QUANTITY_FLAG,
               T.PRO_NO,
               (SELECT BASENAME FROM COM_BASE_INFO WHERE BASECODE = T.IN_MOLD AND ROWNUM = 1) IN_MOLD,
           DECODE(T.FINISHPRO_MOLD,'801801','合同变更','801802','超交货期','801803','超载甩量',
           '801804','成品备库','801805','质量异议待处理') FINISHPRO_MOLD,  TO_CHAR(T2.IN_TIME_F,'YYYY-MM-DD HH24:MI:SS') IN_TIME_F
          FROM MAT_ZC_TRACK T, YDM_ZC_INLIST T2
         WHERE T.MAT_NO = T2.MAT_NO(+)
           AND T.CREATE_TIME BETWEEN TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS') AND
               TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')
           AND T.ORDER_NO  LIKE '%' || ? || '%'
           AND T.JUDGE_STOVE_NO  LIKE '%' || ? || '%'
           AND T.BELONG_CODE  LIKE '%' || ? || '%'
           AND T.PRODUCT_FLAG  LIKE '%' || ? || '%'
           AND T.MAT_STATUS  LIKE '%' || ? || '%'
           AND T.FILL_QUANTITY_FLAG  LIKE '%' || ? || '%' #conditions#) T1
 GROUP BY T1.ORDER_NO,
          T1.ORDER_SEQ,
          T1.ORDER_SEQ_NO,
          T1.PRODUCT_FLAG,
          T1.MAT_STATUS,
          T1.JUDGE_STOVE_NO,
          T1.BATCH_NO,
          T1.BATCH_GROUD_NO,
          T1.EVENT_ID,
          T1.EVENT_DESC,
          T1.FORM_NAME,
          T1.CALL_FUNC_CODING,
          T1.MATERIAL_NO,
          T1.MATERIAL_NAME,
          T1.PRODUCCODE,
          T1.PRODUCNAME,
          T1.STEELCODE,
          T1.STEELNAME,
          T1.STD_CODE,
          T1.STD_NAME,
          T1.STD_STYLE,
          T1.STD_STYLE_DESC,
          T1.SPEC_CODE,
          T1.SPEC_NAME,
          T1.MODEL_CODE,
          T1.MODEL_DESC,
          T1.ACT_LEN_MIN,
          T1.ACT_LEN_MAX,
          T1.OLD_ORDER_NO,
          T1.OLD_ORDER_SEQ,
          T1.OLD_ORDER_SEQ_NO,
          T1.BELONG_CODE,
          T1.BELONG_NAME,
          T1.MEMO,
          T1.CREATE_NAME,
          T1.CREATE_TIME,
          T1.DEPARTMENT_CODE,
          T1.DEPARTMENT_DESC,
          T1.MANAGEMENT_NO,
          T1.MANAGEMENT_NAME,
          T1.FILL_QUANTITY_FLAG,
          T1.PRO_NO,
          T1.FINISHPRO_MOLD,
          T1.IN_MOLD
          ORDER BY T1.CREATE_TIME ASC
</query>
<query id="FrmMatResume.queryMaterialStatusflag" desc="查询材料状态信息">
	<![CDATA[
	 SELECT T.BASECODE, T.BASENAME
  FROM COM_BASE_INFO T
 WHERE T.SORTCODE IN ('801501','801502','801503')
   AND T.VALIDFLAG = '1'
 ORDER BY T.BASECODE    
	]]>
	</query>

</queryMap>