123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495 |
- <?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.zkqy.amichi.mapper.RingScanInformationMapper">
-
- <resultMap type="com.zkqy.amichi.domain.RingScanInformation" id="RingScanInformationResult">
- <result property="id" column="id" />
- <result property="deviceNumber" column="device_number" />
- <result property="deviceName" column="device_name" />
- <result property="scanningTime" column="scanning_time" />
- <result property="contentInformation" column="content_information" />
- <result property="stationName" column="station_name" />
- <result property="personnelName" column="personnel_name" />
- <result property="processName" column="process_name" />
- <result property="executionMessage" column="execution_message"/>
- <result property="executionMark" column="execution_mark"/>
- <result property="orderNumber" column="order_number" />
- <result property="productionOrderNumber" column="production_order_number" />
- <result property="processName" column="process_name" />
- <result property="overNumber" column="over_number" />
- </resultMap>
- <select id="selectRingScanInformationListScfy" parameterType="com.zkqy.amichi.domain.RingScanInformation" resultMap="RingScanInformationResult">
- select id, device_number, station_name, personnel_name,
- process_name,scanning_time, content_information,execution_message,execution_mark,over_number,production_order_number
- from
- fjqydb.ring_scan_information
- <where>
- <if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
- and DATE(scanning_time) = CURDATE() order by scanning_time desc limit #{offset},#{pageSize}
- </where>
- </select>
- <select id="selectRingScanInformationListScfyCount" resultType="java.lang.Integer" parameterType="com.zkqy.amichi.domain.RingScanInformation">
- select count(id) from fjqydb.ring_scan_information
- <where>
- <if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
- and DATE(scanning_time) = CURDATE()
- </where>
- </select>
- <sql id="selectRingScanInformationVo">
- select id, device_number, device_name, scanning_time,process_name,station_name, content_information,personnel_name,order_number,production_order_number,execution_message,over_number from fjqydb.ring_scan_information
- </sql>
- <select id="selectRingScanInformationList" parameterType="com.zkqy.amichi.domain.RingScanInformation" resultMap="RingScanInformationResult">
- <include refid="selectRingScanInformationVo"/>
- <where>
- <if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
- <if test="processName != null and processName != ''"> and process_name = #{processName}</if>
- <if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
- <if test="contentInformation != null and contentInformation != ''"> and content_information = #{contentInformation}</if>
- <if test="nativeNumbering != null and nativeNumbering != ''"> and native_numbering = #{nativeNumbering}</if>
- <if test="productionOrderNumber != null and productionOrderNumber != ''"> and production_order_number = #{productionOrderNumber}</if>
- <if test="executionMark!=null and executionMark!=''">and execution_mark = #{executionMark}</if>
- <if test="productionOrderNumber!=null and productionOrderNumber!=''">and production_order_number = #{productionOrderNumber}</if>
- <if test="orderNumber!=null and orderNumber!=''">and order_number = #{orderNumber}</if>
- <if test="scanningTimes!=null and scanningTimes[0] != null and scanningTimes[0] != ''">
- <![CDATA[ and scanning_time >= #{scanningTimes[0]}]]>
- </if>
- <if test="scanningTimes!=null and scanningTimes[1] != null and scanningTimes[0] != ''">
- <![CDATA[ and scanning_time <= #{scanningTimes[0]}]]>
- </if>
- </where>
- order by scanning_time,process_name
- </select>
- <select id="selectRingScanInformationDownload" parameterType="com.zkqy.amichi.domain.RingScanInformation" resultMap="RingScanInformationResultNR">
- SELECT
- rsi.id,
- rsi.device_number,
- rsi.device_name,
- rsi.scanning_time,
- rsi.content_information,
- rsi.native_numbering,
- rsi.personnel_name,
- rsi.process_name,
- rsi.station_name,
- rsi.execution_mark,
- rsi.execution_message,
- ptd.material_id,
- ptd.material_name,
- ptd.model_number AS model,
- ptd.demand_document,
- rsi.production_order_number,
- rsi.order_number
- FROM
- fjqydb.ring_scan_information as rsi
- LEFT JOIN fjqydb.plan_task_details AS ptd ON ptd.demand_document = rsi.production_order_number
- <where>
- <if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
- <if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
- <if test="scanningTime != null "> and scanning_time = #{scanningTime}</if>
- <if test="personnelName != null "> and personnel_name = #{personnelName}</if>
- <if test="process != null "> and process = #{process}</if>
- <if test="contentInformation != null and contentInformation != ''"> and content_information = #{contentInformation}</if>
- <if test="nativeNumbering != null and nativeNumbering != ''"> and native_numbering = #{nativeNumbering}</if>
- <if test="executionMark!=null and executionMark!=''">and execution_mark = #{executionMark}</if>
- <if test="productionOrderNumber!=null and productionOrderNumber!=''">and rsi.production_order_number = #{productionOrderNumber}</if>
- <if test="orderNumber!=null and orderNumber!=''">and rsi.order_number = #{orderNumber}</if>
- <if test="scanningTimes!=null and scanningTimes[0] != null and scanningTimes[0] != ''">
- <![CDATA[ and scanning_time >= #{scanningTimes[0]}]]>
- </if>
- <if test="scanningTimes!=null and scanningTimes[1] != null and scanningTimes[0] != ''">
- <![CDATA[ and scanning_time <= #{scanningTimes[0]}]]>
- </if>
- </where>
- order by personnel_name,process_name asc,scanning_time desc
- </select>
- <resultMap type="com.zkqy.amichi.domain.vo.RingScanInformationVo" id="RingScanInformationResultNR">
- <result property="id" column="id" />
- <result property="deviceNumber" column="device_number" />
- <result property="deviceName" column="device_name" />
- <result property="scanningTime" column="scanning_time" />
- <result property="contentInformation" column="content_information" />
- <result property="nativeNumbering" column="native_numbering" />
- <result property="orderNumber" column="production_order_number" />
- <result property="serialNumber" column="serial_number" />
- <result property="materialCode" column="material_id" />
- <result property="materialName" column="material_name" />
- <result property="model" column="model" />
- <result property="demandDocument" column="order_number" />
- <result property="personnelName" column="personnel_name" />
- <result property="processName" column="process_name" />
- <result property="stationName" column="station_name" />
- <result property="executionMessage" column="execution_message"/>
- <result property="executionMark" column="execution_mark"/>
- </resultMap>
- <select id="selectRingScanInformationListVo" parameterType="com.zkqy.amichi.domain.RingScanInformation" resultMap="RingScanInformationResultNR">
- SELECT
- rsi.id,
- rsi.device_number,
- rsi.device_name,
- rsi.scanning_time,
- rsi.content_information,
- rsi.native_numbering,
- rsi.personnel_name,
- rsi.process_name,
- rsi.station_name,
- rsi.execution_mark,
- rsi.execution_message,
- ptd.material_id,
- ptd.material_name,
- ptd.model_number AS model,
- ptd.demand_document,
- rsi.production_order_number,
- rsi.order_number
- FROM
- fjqydb.ring_scan_information as rsi
- LEFT JOIN fjqydb.plan_task_details AS ptd ON ptd.demand_document = rsi.production_order_number
- left join fjqydb.production_planning_management as ppm on ptd.plan_id=ppm.id
- <where>
- <if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
- <if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
- <if test="scanningTime != null "> and scanning_time = #{scanningTime}</if>
- <if test="personnelName != null "> and personnel_name like concat('%', #{personnelName}, '%') </if>
- <if test="process != null "> and process like concat('%', #{process}, '%')</if>
- <if test="contentInformation != null and contentInformation != ''"> and content_information like concat('%', #{contentInformation}, '%')</if>
- <if test="nativeNumbering != null and nativeNumbering != ''"> and native_numbering like concat('%', #{nativeNumbering}, '%')</if>
- <if test="executionMark!=null and executionMark!=''">and execution_mark = #{executionMark}</if>
- <if test="productionOrderNumber!=null and productionOrderNumber!=''">and rsi.production_order_number like concat('%', #{productionOrderNumber}, '%')</if>
- <if test="orderNumber!=null and orderNumber!=''">and rsi.order_number like concat('%', #{orderNumber}, '%')</if>
- <if test="scanningTimes!=null and scanningTimes[0] != null and scanningTimes[0] != ''">
- <![CDATA[ and scanning_time >= #{scanningTimes[0]}]]>
- </if>
- <if test="scanningTimes!=null and scanningTimes[1] != null and scanningTimes[0] != ''">
- <![CDATA[ and scanning_time <= #{scanningTimes[0]}]]>
- </if>
- </where>
- order by scanning_time desc
- </select>
- <select id="selectRingScanInformationById" parameterType="Long" resultMap="RingScanInformationResult">
- <include refid="selectRingScanInformationVo"/>
- where id = #{id}
- </select>
- <select id="selectRingScanInformationListDateTimeMax"
- parameterType="com.zkqy.amichi.domain.RingScanInformation" resultMap="RingScanInformationResult">
- <include refid="selectRingScanInformationVo"/>
- <where>
- <if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
- <if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
- <if test="scanningTime != null "> and scanning_time = #{scanningTime}</if>
- <if test="contentInformation != null and contentInformation != ''"> and content_information = #{contentInformation}</if>
- </where>
- order by scanning_time DESC
- LIMIT 1
- </select>
- <select id="selectRingScanInformationLog" resultType="com.zkqy.amichi.domain.vo.RingScanInformationLogVo">
- SELECT
- count(sub.count) as `count`,
- sub.process_name,
- sub.order_number,
- sub.scanning_time,
- sub.production_order_number,
- sub.sort,
- rsif.`status`,
- rsif.start_time,
- rsif.end_time,
- rsif.total_quantity,
- rsif.production_order_total_quantity
- FROM
- (
- SELECT
- rsi.process_name,
- rsi.native_numbering,
- rsi.order_number,
- COUNT( rsi.process_name ) AS count,
- rsi.production_order_number,
- MAX( rsi.scanning_time ) AS scanning_time,
- pl.sort
- FROM
- fjqydb.ring_scan_information AS rsi
- LEFT JOIN fjqydb.procedure_list AS pl ON pl.procedur_name = rsi.process_name
- WHERE
- rsi.execution_mark = '1'
- GROUP BY
- rsi.order_number,rsi.process_name,rsi.native_numbering
- ) AS sub
- LEFT JOIN fjqydb.ring_scan_information_first AS rsif ON ( sub.production_order_number = rsif.production_order_number )
- <where>
- <if test="list != null and list.size()>0">
- sub.order_number IN
- <foreach item="id" collection="list" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- <if test="list == null or list.size() == 0">
- rsi.order_number = 'X'
- </if>
- </where>
- GROUP BY
- sub.order_number,
- sub.process_name
- ORDER BY
- sub.sort,
- rsif.start_time desc
- </select>
- <select id="selectRingScanInformationLog2" resultType="com.zkqy.amichi.domain.vo.RingScanInformationLogVo">
- SELECT
- count(sub.count) as `count`,
- sub.process_name,
- sub.order_number,
- sub.scanning_time,
- sub.production_order_number,
- sub.sort,
- rsif.`status`,
- rsif.start_time,
- rsif.end_time,
- rsif.total_quantity,
- rsif.production_order_total_quantity,
- ptd.model_number as modelNumber,
- ptd.specification as specification
- FROM
- (
- SELECT
- rsi.process_name,
- rsi.native_numbering,
- rsi.order_number,
- COUNT( rsi.process_name ) AS count,
- rsi.production_order_number,
- MAX( rsi.scanning_time ) AS scanning_time,
- pl.sort
- FROM
- fjqydb.ring_scan_information AS rsi
- LEFT JOIN fjqydb.procedure_list AS pl ON pl.procedur_name = rsi.process_name
- WHERE
- rsi.execution_mark = '1'
- GROUP BY
- rsi.production_order_number,rsi.process_name,rsi.native_numbering
- ) AS sub
- LEFT JOIN fjqydb.ring_scan_information_first AS rsif ON ( sub.production_order_number = rsif.production_order_number )
- left join fjqydb.plan_task_details as ptd on ptd.demand_document=sub.production_order_number
- <where>
- <if test="list != null and list.size()>0">
- sub.production_order_number IN
- <foreach item="id" collection="list" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- <if test="list == null or list.size() == 0">
- rsi.production_order_number = 'X'
- </if>
- </where>
- GROUP BY
- sub.production_order_number,
- sub.process_name
- ORDER BY
- rsif.start_time desc,sub.sort
- </select>
- <select id="selectScanStatistics" resultType="com.zkqy.amichi.domain.vo.ScanStatistics" parameterType="com.zkqy.amichi.domain.RingScanInformation">
- SELECT
- CONCAT(c.order_number, '/', c.model_number) AS dOrder,
- c.dCount,
- SUM( CASE WHEN c.execution_mark = 1 THEN 1 ELSE 0 END ) AS dsCount,
- SUM( CASE WHEN c.execution_mark = 2 THEN 1 ELSE 0 END ) As dfCount
- FROM
- (
- SELECT
- rsi.order_number,
- rsi.native_numbering,
- rsif.total_quantity AS dCount,
- rsi.execution_mark,
- ptd.model_number
- FROM
- fjqydb.ring_scan_information rsi
- LEFT JOIN fjqydb.ring_scan_information_first rsif ON rsi.production_order_number = rsif.production_order_number
- LEFT JOIN fjqydb.plan_task_details AS ptd ON rsi.production_order_number = ptd.demand_document
- <where>
- <if test="processName!=null and processName!='' and processName.equals('焊接D')">
- rsi.content_information LIKE concat('%','D', '%' ) and rsi.process_name='焊接'
- </if>
- <if test="processName!=null and processName!='' and processName.equals('焊接Z')">
- rsi.content_information LIKE concat('%','Z', '%' ) and rsi.process_name='焊接'
- </if>
- <if test="productionOrderNumber!=null and productionOrderNumber!=''">
- and rsi.production_order_number=#{productionOrderNumber}
- </if>
- <if test="processName!=null and processName!='' and processName!='焊接D' and processName!='焊接Z'">
- and rsi.process_name like concat('%', #{processName}, '%')
- </if>
- and execution_mark='1'
- </where>
- GROUP BY native_numbering
- ) AS c
- GROUP BY
- order_number
- </select>
- <select id="selectRingScanInformationListLike" resultType="java.lang.String" parameterType="com.zkqy.amichi.domain.RingScanInformation">
- SELECT
- COUNT(1)
- FROM
- fjqydb.ring_scan_information
- <where>
- <if test="processName!=null and processName!='' and processName.equals('焊接D')">
- content_information LIKE concat('%','D', '%' ) and process_name='焊接'
- </if>
- <if test="processName!=null and processName!='' and processName.equals('焊接Z')">
- content_information LIKE concat('%','Z', '%' ) and process_name='焊接'
- </if>
- <if test="orderNumber!=null and orderNumber!=''">
- and order_number=#{orderNumber}
- </if>
- <if test="processName!=null and processName!='' and processName!='焊接D' and processName!='焊接Z'">
- and process_name like concat('%', #{processName}, '%')
- </if>
- and execution_mark='1'
- </where>
- </select>
- <select id="handHeldJournal" resultType="map" parameterType="com.zkqy.amichi.domain.RingScanInformation">
- SELECT
- rsif.total_quantity as Dcount,
- concat(rsi.order_number,'/' ,ptd.model_number) as Dorder,
- rsi.order_number as DorderName,
- rsi.production_order_number ,
- rsi.personnel_name as Uname,
- rsi.station_name as Ugw,
- rsi.process_name as processName,
- SUM( CASE WHEN rsi.execution_mark = 1 THEN 1 ELSE 0 END ) AS dsCount,
- SUM( CASE WHEN rsi.execution_mark = 2 THEN 1 ELSE 0 END ) As dfCount
- FROM
- fjqydb.ring_scan_information AS rsi
- LEFT JOIN fjqydb.ring_scan_information_first AS rsif ON rsi.production_order_number = rsif.production_order_number
- left join fjqydb.plan_task_details as ptd on rsi.production_order_number=ptd.demand_document
- where DATE(rsi.scanning_time) = CURDATE()
- GROUP BY
- rsi.order_number,
- rsi.personnel_name,
- rsi.station_name
- </select>
- <select id="selectRingScanInformationListisNotNull"
- resultType="com.zkqy.amichi.domain.RingScanInformation">
- <include refid="selectRingScanInformationVo"/>
- <where>
- <if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
- <if test="processName != null and processName != ''"> and process_name = #{processName}</if>
- <if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
- <if test="contentInformation != null and contentInformation != ''"> and content_information = #{contentInformation}</if>
- <if test="nativeNumbering != null and nativeNumbering != ''"> and native_numbering = #{nativeNumbering}</if>
- <if test="productionOrderNumber != null and productionOrderNumber != ''"> and production_order_number = #{productionOrderNumber}</if>
- <if test="executionMark!=null and executionMark!=''">and execution_mark = #{executionMark}</if>
- <if test="productionOrderNumber!=null and productionOrderNumber!=''">and production_order_number = #{productionOrderNumber}</if>
- <if test="orderNumber!=null and orderNumber!=''">and order_number = #{orderNumber}</if>
- <if test="scanningTimes!=null and scanningTimes[0] != null and scanningTimes[0] != ''">
- <![CDATA[ and scanning_time >= #{scanningTimes[0]}]]>
- </if>
- <if test="scanningTimes!=null and scanningTimes[1] != null and scanningTimes[0] != ''">
- <![CDATA[ and scanning_time <= #{scanningTimes[0]}]]>
- </if>
- and order_number is not null
- </where>
- order by scanning_time,process_name
- </select>
- <select id="selectRingScanInfoByUserNameAndOrderNumber" resultType="java.lang.String">
- SELECT
- COUNT(DISTINCT rsi.native_numbering) AS completedMachines
- FROM
- fjqydb.ring_scan_information AS rsi
- WHERE
- rsi.process_name = #{gw}
- AND rsi.personnel_name = #{uname}
- AND rsi.order_number =#{dorder}
- AND rsi.execution_mark = '1'
- GROUP BY
- rsi.personnel_name,
- rsi.order_number;
- </select>
- <select id="scanCodeLogOrderInfo" resultType="java.util.Map">
- SELECT
- rsif.order_number AS order_number,
- rsif.total_quantity,
- rsif.start_time,
- COUNT(CASE WHEN rsi.process_name = '入库' THEN rsif.order_number END) AS over_number
- FROM
- fjqydb.`ring_scan_information_first` AS rsif
- LEFT JOIN fjqydb.ring_scan_information AS rsi ON rsif.order_number = rsi.order_number
- WHERE
- rsi.execution_mark =1
- GROUP BY
- rsif.order_number
- ORDER BY rsif.start_time desc
- </select>
- <insert id="insertRingScanInformation" parameterType="com.zkqy.amichi.domain.RingScanInformation" useGeneratedKeys="true" keyProperty="id">
- insert into fjqydb.ring_scan_information
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="deviceNumber != null">device_number,</if>
- <if test="deviceName != null">device_name,</if>
- <if test="scanningTime != null">scanning_time,</if>
- <if test="contentInformation != null">content_information,</if>
- <if test="nativeNumbering != null">native_numbering,</if>
- <if test="personnelName != null">personnel_name,</if>
- <if test="process != null">process,</if>
- <if test="processName != null">process_name,</if>
- <if test="orderNumber != null">order_number,</if>
- <if test="productionOrderNumber != null">production_order_number,</if>
- <if test="stationId != null">station_id,</if>
- <if test="stationName != null">station_name,</if>
- <if test="executionMark != null">execution_mark,</if>
- <if test="executionMessage != null">execution_message,</if>
- <if test="overNumber != null">over_number,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="deviceNumber != null">#{deviceNumber},</if>
- <if test="deviceName != null">#{deviceName},</if>
- <if test="scanningTime != null">#{scanningTime},</if>
- <if test="contentInformation != null">#{contentInformation},</if>
- <if test="nativeNumbering != null">#{nativeNumbering},</if>
- <if test="personnelName != null">#{personnelName},</if>
- <if test="process != null">#{process},</if>
- <if test="processName != null">#{processName},</if>
- <if test="orderNumber != null">#{orderNumber},</if>
- <if test="productionOrderNumber != null">#{productionOrderNumber},</if>
- <if test="stationId != null">#{stationId},</if>
- <if test="stationName != null">#{stationName},</if>
- <if test="executionMark != null">#{executionMark},</if>
- <if test="executionMessage != null">#{executionMessage},</if>
- <if test="overNumber != null">#{overNumber},</if>
- </trim>
- </insert>
- <update id="updateRingScanInformation" parameterType="com.zkqy.amichi.domain.RingScanInformation">
- update fjqydb.ring_scan_information
- <trim prefix="SET" suffixOverrides=",">
- <if test="deviceNumber != null">device_number = #{deviceNumber},</if>
- <if test="deviceName != null">device_name = #{deviceName},</if>
- <if test="scanningTime != null">scanning_time = #{scanningTime},</if>
- <if test="contentInformation != null">content_information = #{contentInformation},</if>
- <if test="stationId != null">station_id=#{stationId},</if>
- <if test="stationName != null">station_name=#{stationName},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteRingScanInformationById" parameterType="Long">
- delete from fjqydb.ring_scan_information where id = #{id}
- </delete>
- <delete id="deleteRingScanInformationByIds" parameterType="String">
- delete from fjqydb.ring_scan_information where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|