#
Junjie
2023-12-28 79e603ec5550093b6401c781c3f0cde45b12396c
zy-asrs-common/src/main/resources/mapper/wms/WrkDetlMapper.xml
@@ -2,4 +2,19 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zy.asrs.common.wms.mapper.WrkDetlMapper">
    <select id="selectAndLogByOrderNoGroupByMatnrOfSum" resultType="com.zy.asrs.common.wms.entity.WrkDetl">
        select awd.wrk_no, awd.io_time, awd.matnr, sum(awd.anfme) as anfme
        from wms_wrk_detl awd
                 left join wms_wrk_mast awm on awd.wrk_no = awm.wrk_no and awd.io_time = awm.io_time
        where order_no = #{orderNo}
        group by awd.wrk_no, awd.io_time, awd.matnr
        union
        select distinct awdl.wrk_no, awdl.io_time, awdl.matnr, sum(awdl.anfme) as anfme
        from wms_wrk_detl_log awdl
                 left join wms_wrk_mast_log awml on awdl.wrk_no = awml.wrk_no and awdl.io_time = awml.io_time
        where awdl.order_no = #{orderNo}
          and (awml.manu_type is null or awml.manu_type != '手动取消')
        group by awdl.wrk_no, awdl.io_time, awdl.matnr
    </select>
</mapper>