<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="库存跟踪报表">
	<query id="FrmOrderStock.getOrderStockInfo" desc="库存跟踪信息查询">
            <![CDATA[
               SELECT T1.ORDER_NO || '/' || T1.ORDER_SEQ ORDER_NO,
       T1.JUDGE_STOVE_NO,
       T1.BATCH_NO,
       T1.BATCH_GROUD_NO,
       T1.SPEC_NAME,
       T1.PRODUCNAME,
       T1.GRADENAME,
       T1.SPEC_NAME,
       T1.MODEL_DESC,
       T1.STD_NAME,
       TO_CHAR(MAX(T1.CREATE_TIME),'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
       SUM(CASE
             WHEN T1.MAT_STATUS != '80150303' THEN
              T1.ACT_COUNT
             ELSE
              0
           END) ACT_COUNT,
       SUM(CASE
             WHEN T1.MAT_STATUS != '80150303' THEN
              T1.ACT_WEIGHT
             ELSE
              0
           END) ACT_WEIGHT,
       SUM(NVL(T3.ACT_COUNT, 0)) BILL_COUNT,
       SUM(NVL(T3.ACT_WEIGHT, 0)) BILL_WEIGHT,
       SUM(CASE
             WHEN T3.EDIT_FLAG = '1' THEN
              T3.ACT_COUNT
             ELSE
              0
           END) TALL_COUNT,
       SUM(CASE
             WHEN T3.EDIT_FLAG = '1' THEN
              T3.ACT_WEIGHT
             ELSE
              0
           END) TALL_WEIGHT,
       SUM(NVL(T4.ACT_COUNT, 0)) LOAD_COUNT,
       SUM(NVL(CASE
                 WHEN T3.PRT_FLAG = '0' THEN
                  T4.ACT_WEIGHT
                 ELSE
                  T4.PONDER_GROSS_WT
               END,
               0)) LOAD_WEIGHT

  FROM MAT_ZC_M               T1,
       YDM_ZC_BUTTRESS        T2,
       YDM_ZC_BILL_C          T3,
       YDM_ZC_LOADVEHICLE_MAT T4
 WHERE T1.MAT_NO = T2.MAT_NO(+)
   AND T1.MAT_NO = T3.MAT_NO(+)
   AND T1.MAT_NO = T4.MAT_NO(+)
   AND UPPER(T1.ORDER_NO) || '&' LIKE UPPER('%' || ? || '%')
                ]]>
	</query>
</queryMap>