<?xml version="1.0" encoding="utf-8" ?>
<select>
  <selectstr>
SELECT u_mattress_interface_qd.mattressid
	,u_mattress_interface_qd.printid
	,u_mattress_interface_qd.itemname
	,u_mattress_interface_qd.bj_pzname
	,u_mattress_interface_qd.bj_pzname_mx
	,u_mattress_interface_qd.bj_pzname_mx_mx
	,u_mattress_interface_qd.mtrlid
	,u_mattress_interface_qd.erp_mtrlid
	,u_mattress_interface_qd.useqty
	,u_mattress_interface_qd.dscrp
	,u_mtrl_price.name AS mtrlname
	,u_mattress_interface_qd.actual_useqty
	,u_mattress_interface_qd.qd_actual_size
	,u_mattress_interface_qd.qd_pfgroupqty
	,u_mattress_interface_qd.wrkgrpid
	,u_mattress_interface_qd.ss_rate
	,u_mattress_interface_qd.ls_rate
	,u_mattress_interface_qd.sh_rate
	,Space(200) AS erp_mtrlcode
	,Space(200) AS erp_mtrlname
	,Space(200) AS erp_mtrlmode
	,Space(200) AS erp_unit
	,Space(200) AS mtrlengname
FROM u_mattress_interface_qd
LEFT JOIN u_mtrl_price ON u_mtrl_price.mtrlid = u_mattress_interface_qd.mtrlid
  </selectstr>
  <where>
	<when notnull="@mattressid">
		u_mattress_interface_qd.mattressid = @mattressid
	</when>
  </where>
  <displayfields>
    <field field="printid">排序</field>
    <field field="itemname">项目</field>
    <field field="bj_pzname">二级项目</field>
    <field field="bj_pzname_mx">明细项目</field>
    <field field="bj_pzname_mx_mx">二级明细项目</field>
    <field field="erp_mtrlcode">L1物料编码</field>
    <field field="mtrlengname">自定义2</field>
    <field field="erp_mtrlname">L1物料名称</field>
    <field field="erp_mtrlmode">L1物料规格</field>
    <field field="erp_unit">L1物料单位</field>
    <field field="useqty" datatype="number">参考用料量</field>
    <field field="actual_useqty" datatype="number">实际用量</field>
    <field field="wrkgrpid">领用工组</field>
    <field field="qd_actual_size">实际尺寸</field>
    <field field="qd_pfgroupqty">条数</field>
    <field field="dscrp">备注</field>
    <field field="ss_rate" datatype="number">收缩率</field>
    <field field="ls_rate" datatype="number">拉伸率</field>
    <field field="sh_rate" datatype="number">损耗率</field>
  </displayfields>
</select>
