<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc ="调差">
<query id = "FrmStuffAdjust.doQueryStock" desc = "查询调差实绩">
<![CDATA[
SELECT 
       BELONG_NAME,
       PRO_ORDER_NO,
       PRO_ORDER_ID,
       TO_CHAR(STOCKTAKING_TIME, 'YYYY-MM-DD HH24:MI:SS') STOCKTAKING_TIME,
       STORAGE_NO,
       BAL_YEAR_MONTH,
       MEMO,
       CREATE_NAME,
       STOCKTAKING_DOC,
       STOCKTAKING_RSN_NAME,
       STOVE_NO,
       FLAG_STOVE_NO,
       JUDGE_STOVE_NO,
       GROUD_NO,
       BATCH_NO,
       CAST_NO,
       CCMID,
       SAMPLE_FLAG,
       CUTTING_FLAG,
       CUTTING_NUM,
       MATERIAL_NAME,
       PRODUCNAME,
       JUDGE_GRADENAME,
       JUDGE_STD_NAME,
       ACT_DIMATER,
       ACT_LEN,
       ACT_LEN_MIN,
       ACT_LEN_MAX,
       ACT_FIX_NUM,
       ACT_FIX_LEN,
       ACT_WEIGHT,
       PLINE_NAME
 FROM YDM_GP_STOCKTAKINGLIST
 WHERE STOCKTAKING_TYPE_CODE = '800603'
 AND JUDGE_STOVE_NO || '&' LIKE ('%' || ? || '%')
 ]]>
</query>
<query id = "FrmStuffAdjust.selectMatStaus" desc= "查询材料状态">
SELECT SUM(T.ACT_COUNT)ACOUNT,SUM(T.ACT_WEIGHT)WEIGHT
  FROM MAT_GP_M T, YDM_GP_BUTTRESS S
 WHERE T.MAT_NO = S.MAT_NO
   AND T.STOVE_NO = ?
   AND T.JUDGE_STOVE_NO =?
   AND T.BATCH_NO=?
   AND T.GROUD_NO = ?
   AND T.PRODUCT_FLAG = ?
   AND T.MAT_STATUS = ?
   AND S.STORAGE_NO = ?
</query>
<query id = "FrmStuffAdjust.selectMatNo" desc = "查询材料号">
SELECT T.MAT_NO
  FROM MAT_GP_M T, YDM_GP_BUTTRESS S
 WHERE T.MAT_NO = S.MAT_NO
   AND T.STOVE_NO = ?
   AND T.JUDGE_STOVE_NO =?
   AND T.BATCH_NO=?
   AND T.GROUD_NO = ?
   AND T.PRODUCT_FLAG = ?
   AND T.MAT_STATUS = ?
   AND S.STORAGE_NO = ?
</query>
<query id="FrmStuffAdjust.queryAdjustList" desc="查询调差单号">
	<![CDATA[
    select STOCKTAKING_SQE,STOCKTAKING_DOC from ydm_gp_stocktakinglist 
    where CREATE_TIME LIKE '%'|| to_date(?,'YYYY/MM/DD')||'%'  
    and  STOCKTAKING_TYPE_CODE LIKE '%'|| ? ||'%'
    order by STOCKTAKING_DOC desc
	]]>
	</query>
	<query id="FrmStuffAdjust.queryAdjustList1" desc="查询调差流水号">
	<![CDATA[
    select STOCKTAKING_SQE,STOCKTAKING_DOC from ydm_gp_stocktakinglist 
    where CREATE_TIME LIKE '%'|| to_date(?,'YYYY/MM/DD')||'%'  
    and  STOCKTAKING_DOC LIKE '%'|| ? ||'%'
    order by STOCKTAKING_SQE desc
	]]>
	</query>
	<query id = "FrmStuffAdjust.updateActWgt" desc = "对物料主表中的重量更新">
	UPDATE MAT_GP_M T SET T.ACT_WEIGHT = ? WHERE T.MAT_NO = ?
	</query>
	<query id = "FrmStuffAdjust.insertAdjust" desc = "插入调差表">
	 INSERT INTO YDM_GP_STOCKTAKINGLIST(
        BELONG_NAME,
        PRO_ORDER_NO,
        PRO_ORDER_ID,
        STOCKTAKING_TIME,
        STORAGE_NO,
        LOCATION_NO,
        STORAGE_ATTR,
        STORAGE_ATTR_NAME,
        STORAGE_TYPE_NO,
        STORAGE_TYPE_NAME,
        DEPARTMENT_CODE,
        DEPARTMENT_DESC,
        MANAGEMENT_NO,
        MANAGEMENT_NAME,
        BAL_YEAR_MONTH,
        MEMO,
        CREATE_NAME,
        CREATE_TIME,
        STOCKTAKING_SQE,
        STOCKTAKING_DOC,
        STOCKTAKING_TYPE_CODE,
        STOCKTAKING_TYPE_NAME,
        STOCKTAKING_RSN_CODE,
        STOCKTAKING_RSN_NAME,
        PRODUCT_FLAG,
        MAT_STATUS,
        STOVE_NO,
        FLAG_STOVE_NO,
        LOT_NO,
        JUDGE_STOVE_NO,
        GROUD_NO,
        BATCH_NO,
        CAST_NO,
        CCMID,
        SAMPLE_FLAG,
        CUTTING_FLAG,
        CUTTING_NUM,
        MATERIAL_NO,
        MATERIAL_NAME,
        PRODUCCODE,
        PRODUCNAME,
        JUDGE_GRADECODE,
        JUDGE_GRADENAME,
        JUDGE_STD_CODE,
        JUDGE_STD_NAME,
        ACT_DIMATER,
        ACT_HEIGHT,
        ACT_LEN,
        ACT_LEN_MIN,
        ACT_LEN_MAX,
        ACT_FIX_NUM,
        ACT_FIX_LEN,
        ACT_COUNT,
        ACT_WEIGHT,
        ACT_THEORY_WEIGHT,
        PLINE_CODE,
        PLINE_NAME,
        BELONG_CODE)
 VALUES( 
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?)
	</query>
</queryMap>