123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.steerinfo.ems.ifmesemsswapfile.mapper.IfMesEmsSwapfileMapper">
- <resultMap id="BaseResultMap" type="com.steerinfo.ems.ifmesemsswapfile.model.IfMesEmsSwapfile">
- <result column="FID" jdbcType="VARCHAR" property="fid" />
- <result column="TYPE" jdbcType="VARCHAR" property="type" />
- <result column="WORKS" jdbcType="VARCHAR" property="works" />
- <result column="PRODLINE" jdbcType="VARCHAR" property="prodline" />
- <result column="PRODATE" jdbcType="DATE" property="prodate" />
- <result column="ORDERNO" jdbcType="VARCHAR" property="orderno" />
- <result column="MATERIALCODE" jdbcType="VARCHAR" property="materialcode" />
- <result column="MATERIALNAME" jdbcType="VARCHAR" property="materialname" />
- <result column="UNIT" jdbcType="VARCHAR" property="unit" />
- <result column="QTY" jdbcType="DECIMAL" property="qty" />
- <result column="CREATETIME" jdbcType="DATE" property="createtime" />
- <result column="STATUS" jdbcType="VARCHAR" property="status" />
- <result column="SENDTIME" jdbcType="DATE" property="sendtime" />
- <result column="MEMO" jdbcType="DATE" property="memo" />
- </resultMap>
- <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
- select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME,MEMO
- from IF_MES_EMS_SWAPFILE
- where FID = #{id,jdbcType=VARCHAR}
- </select>
- <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
- delete from IF_MES_EMS_SWAPFILE
- <where>
- <if test="fid != null and fid != ''">
- and FID = #{fid}
- </if>
- <if test="type != null and type != ''">
- and TYPE = #{type}
- </if>
- <if test="works != null and works != ''">
- and WORKS = #{works}
- </if>
- <if test="prodline != null and prodline != ''">
- and PRODLINE = #{prodline}
- </if>
- <if test="prodate != null">
- and PRODATE = #{prodate}
- </if>
- <if test="orderno != null and orderno != ''">
- and ORDERNO = #{orderno}
- </if>
- <if test="materialcode != null and materialcode != ''">
- and MATERIALCODE = #{materialcode}
- </if>
- <if test="materialname != null and materialname != ''">
- and MATERIALNAME = #{materialname}
- </if>
- <if test="unit != null and unit != ''">
- and UNIT = #{unit}
- </if>
- <if test="qty != null and qty != ''">
- and QTY = #{qty}
- </if>
- <if test="createtime != null and createtime != ''">
- and CREATETIME = #{createtime}
- </if>
- <if test="status != null and status != ''">
- and STATUS = #{status}
- </if>
- <if test="sendtime != null and sendtime != ''">
- and SENDTIME = #{sendtime}
- </if>
- </where>
- </delete>
-
- <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME,MEMO
- from IF_MES_EMS_SWAPFILE
- <where>
- <if test="fid != null and fid != ''">
- and FID = #{fid}
- </if>
- <if test="type != null and type != ''">
- and TYPE = #{type}
- </if>
- <if test="works != null and works != ''">
- and WORKS = #{works}
- </if>
- <if test="prodline != null and prodline != ''">
- and PRODLINE = #{prodline}
- </if>
- <if test="prodate != null and prodate != ''">
- and to_char(PRODATE,'yyyy-MM-dd') LIKE '${prodate}%'
- </if>
- <if test="orderno != null and orderno != ''">
- and ORDERNO = #{orderno}
- </if>
- <if test="materialcode != null and materialcode != ''">
- and MATERIALCODE = #{materialcode}
- </if>
- <if test="materialname != null and materialname != ''">
- and MATERIALNAME = #{materialname}
- </if>
- <if test="unit != null and unit != ''">
- and UNIT = #{unit}
- </if>
- <if test="qty != null and qty != ''">
- and QTY = #{qty}
- </if>
- <if test="createtime != null and createtime != ''">
- and CREATETIME = #{createtime}
- </if>
- <if test="status != null and status != ''">
- and STATUS = #{status}
- </if>
- <if test="sendtime != null and sendtime != ''">
- and SENDTIME = #{sendtime}
- </if>
- </where>
- </select>
- <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME,MEMO
- from IF_MES_EMS_SWAPFILE
- <where>
- <if test="fid != null and fid != ''">
- and FID LIKE '%${fid}%'
- </if>
- <if test="type != null and type != ''">
- and TYPE = #{type}
- </if>
- <if test="works != null and works != ''">
- and WORKS LIKE '%${works}%'
- </if>
- <if test="prodline != null and prodline != ''">
- and PRODLINE LIKE '%${prodline}%'
- </if>
- <if test="prodate != null and prodate != ''">
- and PRODATE LIKE '%${prodate}%'
- </if>
- <if test="orderno != null and orderno != ''">
- and ORDERNO LIKE '%${orderno}%'
- </if>
- <if test="materialcode != null and materialcode != ''">
- and MATERIALCODE LIKE '%${materialcode}%'
- </if>
- <if test="materialname != null and materialname != ''">
- and MATERIALNAME LIKE '%${materialname}%'
- </if>
- <if test="unit != null and unit != ''">
- and UNIT LIKE '%${unit}%'
- </if>
- <if test="qty != null and qty != ''">
- and QTY LIKE '%${qty}%'
- </if>
- <if test="createtime != null and createtime != ''">
- and CREATETIME LIKE '%${createtime}%'
- </if>
- <if test="status != null and status != ''">
- and STATUS = #{status}
- </if>
- <if test="sendtime != null and sendtime != ''">
- and SENDTIME LIKE '%${sendtime}%'
- </if>
- </where>
- </select>
- <select id="selectNewMaterial" parameterType="java.util.HashMap" resultMap="BaseResultMap">
- select FID, TYPE, WORKS, PRODLINE, PRODATE, ORDERNO, MATERIALCODE, MATERIALNAME, UNIT, QTY, CREATETIME, STATUS, SENDTIME,MEMO
- from IF_MES_EMS_SWAPFILE
- where TYPE = #{type,jdbcType=VARCHAR}
- and STATUS in ('0','9')
- order by PRODATE, PRODLINE, MATERIALCODE
- </select>
- <select id="getSUM" parameterType="java.util.HashMap" resultType="java.math.BigDecimal">
- SELECT
- SUM (qty) SUMQTY
- FROM IF_MES_EMS_SWAPFILE T
- WHERE T.TYPE = '1'
- AND T.PRODLINE IN (${prodlines})
- AND T.MATERIALCODE
- <if test="isnot == 'not'">
- NOT
- </if>
- IN (${materialcodes})
- AND TO_CHAR(T.PRODATE, 'yyyy-MM-dd') = #{dataDay,jdbcType=VARCHAR}
- </select>
-
- <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.ifmesemsswapfile.model.IfMesEmsSwapfile">
- update IF_MES_EMS_SWAPFILE
- set TYPE = #{type,jdbcType=VARCHAR},
- WORKS = #{works,jdbcType=VARCHAR},
- PRODLINE = #{prodline,jdbcType=VARCHAR},
- PRODATE = to_date(#{prodate}, 'YYYY-MM-DD HH24:MI:SS'),
- ORDERNO = #{orderno,jdbcType=VARCHAR},
- MATERIALCODE = #{materialcode,jdbcType=VARCHAR},
- MATERIALNAME = #{materialname,jdbcType=VARCHAR},
- UNIT = #{unit,jdbcType=VARCHAR},
- QTY = #{qty,jdbcType=VARCHAR},
- CREATETIME = to_date(#{createtime}, 'YYYY-MM-DD HH24:MI:SS'),
- STATUS = #{status,jdbcType=VARCHAR}
- where FID = #{fid,jdbcType=VARCHAR}
- </update>
-
- <update id="updateStatus" parameterType="java.util.HashMap">
- update IF_MES_EMS_SWAPFILE
- <set>
- <if test="status != null">
- STATUS = #{status,jdbcType=VARCHAR},
- SENDTIME = SYSDATE,
- </if>
- </set>
- where FID = #{fid,jdbcType=VARCHAR}
- </update>
- <insert id="insert" parameterType="com.steerinfo.ems.ifmesemsswapfile.model.IfMesEmsSwapfile">
- insert into IF_MES_EMS_SWAPFILE
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="fid != null">
- FID,
- </if>
- <if test="type != null">
- TYPE,
- </if>
- <if test="works != null">
- WORKS,
- </if>
- <if test="prodline != null">
- PRODLINE,
- </if>
- <if test="prodate != null">
- PRODATE,
- </if>
- <if test="orderno != null">
- ORDERNO,
- </if>
- <if test="materialcode != null">
- MATERIALCODE,
- </if>
- <if test="materialname != null">
- MATERIALNAME,
- </if>
- <if test="unit != null">
- UNIT,
- </if>
- <if test="qty != null">
- QTY,
- </if>
- <if test="createtime != null">
- CREATETIME,
- </if>
- <if test="status != null">
- STATUS,
- </if>
- <if test="sendtime != null">
- SENDTIME,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="fid != null">
- #{fid,jdbcType=VARCHAR},
- </if>
- <if test="type != null">
- #{type,jdbcType=VARCHAR},
- </if>
- <if test="works != null">
- #{works,jdbcType=VARCHAR},
- </if>
- <if test="prodline != null">
- #{prodline,jdbcType=VARCHAR},
- </if>
- <if test="prodate != null">
- to_date ( #{prodate} , 'YYYY-MM-DD HH24:MI:SS' ),
- </if>
- <if test="orderno != null">
- #{orderno,jdbcType=VARCHAR},
- </if>
- <if test="materialcode != null">
- #{materialcode,jdbcType=VARCHAR},
- </if>
- <if test="materialname != null">
- #{materialname,jdbcType=VARCHAR},
- </if>
- <if test="unit != null">
- #{unit,jdbcType=VARCHAR},
- </if>
- <if test="qty != null">
- #{qty,jdbcType=DECIMAL},
- </if>
- <if test="createtime != null">
- to_date ( #{createtime} , 'YYYY-MM-DD HH24:MI:SS' ),
- </if>
- <if test="status != null">
- #{status,jdbcType=VARCHAR},
- </if>
- <if test="sendtime != null">
- to_date ( #{sendtime} , 'YYYY-MM-DD HH24:MI:SS' ),
- </if>
- </trim>
- </insert>
- <select id="getQueryList" parameterType="java.util.HashMap" resultType = "Map">
- SELECT s.FID, s.TYPE, s.WORKS, s.PRODLINE, CASE WHEN s.TYPE = 1 THEN m.WORKPROCID WHEN s.TYPE = 2 THEN p.WORKPROCID END AS WORKPROCID, s.PRODATE, s.ORDERNO, s.MATERIALCODE, s.MATERIALNAME, s.UNIT, s.QTY, s.CREATETIME, s.STATUS, s.SENDTIME, s.MEMO
- FROM IF_MES_EMS_SWAPFILE s
- LEFT JOIN T_RM_WORKPROC_PRODUCT p ON s.MATERIALCODE = p.MES_MATERIALCODE
- LEFT JOIN T_RM_WORKPROC_MATERIAL m ON s.MATERIALCODE = m.MES_MATERIALCODE
- WHERE (m.WORKPROCID IN (${workProcids}) OR p.WORKPROCID IN (${workProcids}))
- <if test="prodate != null and prodate != ''">
- AND s.PRODATE >= to_date(#{prodate}, 'yyyy-mm-dd')
- </if>
- <if test="prodate2 != null and prodate2 != ''">
- AND s.PRODATE <= to_date(#{prodate2}, 'yyyy-mm-dd')
- </if>
- <if test="workproc != null and workproc != ''">
- AND (p.WORKPROCID LIKE '%${workproc}%' OR m.WORKPROCID LIKE '%${workproc}%')
- </if>
- <if test="materialname != null and materialname != ''">
- AND s.MATERIALNAME LIKE '%${materialname}%'
- </if>
- <if test="materialcode != null and materialcode != ''">
- AND s.MATERIALCODE LIKE '%${materialcode}%'
- </if>
- <if test="prodline != null and prodline != ''">
- AND s.PRODLINE LIKE '%${prodline}%'
- </if>
- <if test="type != null and type != ''">
- AND s.TYPE LIKE '%${type}%'
- </if>
- ORDER BY s.PRODATE
- </select>
- <select id="queryProductAndMaterial" parameterType="java.util.HashMap" resultType = "Map">
- SELECT A.ITEMID, A.CLOCK, A.TIMEGRANID, A.ACTUALVALUE, A.CORRECTVALUE
- , A.APPORTVALUE, A.BZ, A.USERID, A.UPDATETIME, A.UPMAN
- , A.UPTIME, B.WORKPROCID, B.MES_MATERIALCODE, B.UNITID, B.${listing} AS MATERIALNAME
- FROM ${table_name2} A
- LEFT JOIN ${table_name} B ON A.ITEMID = B.ITEMID
- WHERE B.WORKPROCID IN (${workProcids})
- <if test="clock != null and clock != ''">
- AND A.CLOCK >= #{clock}
- </if>
- <if test="clock2 != null and clock2 != ''">
- AND A.CLOCK <= #{clock2}
- </if>
- AND B.ITEMTYPE = 'R'
- AND B.USEFLAG = '1'
- AND B.ISFINANCEDATA = '1'
- <if test="workproc != null and workproc != ''">
- AND B.WORKPROCID IN (${workProcs})
- </if>
- <if test="materialcode != null and materialcode != ''">
- AND B.MES_MATERIALCODE LIKE '%${materialcode}%'
- </if>
- <if test="itemid != null and itemid != ''">
- AND A.ITEMID LIKE '%${itemid}%'
- </if>
- <if test="itemtype !=null and itemtype!='' ">
- AND B.ITEMTYPE = #{itemtype}
- </if>
- <if test="materialname !=null and materialname!='' ">
- AND B.${listing} = #{materialname}
- </if>
- ORDER BY A.CLOCK,B.SEQNO
- </select>
- <update id="updateProductAndMaterial" parameterType="java.util.HashMap">
- UPDATE ${table_name}
- SET APPORTVALUE = #{apportvalue},
- CORRECTVALUE = #{correctvalue},
- BZ = #{bz},
- UPMAN = #{upman},
- UPTIME = #{uptime}
- WHERE ITEMID = #{itemid}
- AND CLOCK = #{clock}
- AND TIMEGRANID = #{timegranid}
- AND ACTUALVALUE = #{actualvalue}
- </update>
- </mapper>
|