You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
140 lines
6.5 KiB
140 lines
6.5 KiB
<?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.gaotao.modules.warehouse.dao.LabelTransactionLogMapper">
|
|
|
|
<!-- 查询标签变动记录列表 -->
|
|
<select id="queryList" resultType="java.util.Map">
|
|
SELECT
|
|
a.Site as site,
|
|
a.bu_no as buNo,
|
|
a.transaction_id as transactionId,
|
|
a.document_type AS documentType,
|
|
a.document_no AS documentNo,
|
|
a.order_no AS orderNo,
|
|
a.order_line_no as orderLineNo,
|
|
a.roll_no AS rollNo,
|
|
a.roll_qty AS rollQty,
|
|
a.batch_no AS batchNo,
|
|
a.part_no AS partNo,
|
|
d.PartDescription as partDesc,
|
|
d.Spec AS spec,
|
|
a.warehouse_id as warehouseId,
|
|
b.WareHouseName as warehouseName,
|
|
a.location_id as locationId,
|
|
c.LocationName as locationName,
|
|
CASE WHEN a.synced_flag = 'Y' THEN '已传输' ELSE '待传输' END as syncedFlag,
|
|
CONVERT(VARCHAR(19), a.synced_time, 120) AS syncedTime,
|
|
a.synced_error_msg AS syncedErrorMsg,
|
|
a.bom_item_no AS bomItemNo,
|
|
a.transaction_by as transactionBy,
|
|
CONVERT(VARCHAR(19), a.transaction_date, 120) AS transactionDate
|
|
FROM StockTransactionLog as a
|
|
LEFT JOIN WareHouse as b ON a.site = b.site AND a.bu_no = b.bu_no AND a.warehouse_id = b.WareHouseID
|
|
LEFT JOIN Location as c ON a.site = c.site AND a.bu_no = c.bu_no AND a.location_id = c.LocationID
|
|
left join part as d on a.site = d.site and a.part_no = d.PartNo
|
|
WHERE a.site IN (SELECT site FROM AccessSite WHERE userID = #{query.userName})
|
|
AND a.bu_no IN (SELECT bu_no FROM AccessBu WHERE username = #{query.userName})
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
AND a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test="query.documentType != null and query.documentType != ''">
|
|
<choose>
|
|
<when test="query.documentType == '移库调拨'">
|
|
AND a.document_type IN ('调拨出库', '调拨入库')
|
|
</when>
|
|
<otherwise>
|
|
AND a.document_type = #{query.documentType}
|
|
</otherwise>
|
|
</choose>
|
|
</if>
|
|
<if test="query.rollNo != null and query.rollNo != ''">
|
|
AND a.roll_no LIKE '%' + #{query.rollNo} + '%'
|
|
</if>
|
|
<if test="query.partNo != null and query.partNo != ''">
|
|
AND a.part_no LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test="query.partDesc != null and query.partDesc != ''">
|
|
AND d.PartDescription LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test="query.spec != null and query.spec != ''">
|
|
AND d.Spec LIKE '%' + #{query.spec} + '%'
|
|
</if>
|
|
<if test="query.documentNo != null and query.documentNo != ''">
|
|
AND a.document_no LIKE '%' + #{query.documentNo} + '%'
|
|
</if>
|
|
<if test="query.orderNo != null and query.orderNo != ''">
|
|
AND a.order_no LIKE '%' + #{query.orderNo} + '%'
|
|
</if>
|
|
<if test="query.orderLineNo != null and query.orderLineNo != ''">
|
|
AND a.order_line_no LIKE '%' + #{query.orderLineNo} + '%'
|
|
</if>
|
|
<if test="query.syncedFlag != null and query.syncedFlag != ''">
|
|
AND a.synced_flag = #{query.syncedFlag}
|
|
</if>
|
|
<if test="query.startDate != null and query.startDate != ''">
|
|
AND a.transaction_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null and query.endDate != ''">
|
|
AND a.transaction_date < DATEADD(DAY, 1, #{query.endDate})
|
|
</if>
|
|
ORDER BY a.transaction_date DESC, a.transaction_id DESC
|
|
OFFSET #{query.offset} ROWS FETCH NEXT #{query.limit} ROWS ONLY
|
|
</select>
|
|
|
|
<!-- 查询标签变动记录总数 -->
|
|
<select id="queryTotal" resultType="int">
|
|
SELECT COUNT(1)
|
|
FROM StockTransactionLog as a
|
|
LEFT JOIN WareHouse as b ON a.site = b.site AND a.bu_no = b.bu_no AND a.warehouse_id = b.WareHouseID
|
|
LEFT JOIN Location as c ON a.site = c.site AND a.bu_no = c.bu_no AND a.location_id = c.LocationID
|
|
left join part as d on a.site = d.site and a.part_no = d.PartNo
|
|
WHERE a.site IN (SELECT site FROM AccessSite WHERE userID = #{query.userName})
|
|
AND a.bu_no IN (SELECT bu_no FROM AccessBu WHERE username = #{query.userName})
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
AND a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test="query.documentType != null and query.documentType != ''">
|
|
<choose>
|
|
<when test="query.documentType == '移库调拨'">
|
|
AND a.document_type IN ('调拨出库', '调拨入库')
|
|
</when>
|
|
<otherwise>
|
|
AND a.document_type = #{query.documentType}
|
|
</otherwise>
|
|
</choose>
|
|
</if>
|
|
<if test="query.rollNo != null and query.rollNo != ''">
|
|
AND a.roll_no LIKE '%' + #{query.rollNo} + '%'
|
|
</if>
|
|
<if test="query.partNo != null and query.partNo != ''">
|
|
AND a.part_no LIKE '%' + #{query.partNo} + '%'
|
|
</if>
|
|
<if test="query.partDesc != null and query.partDesc != ''">
|
|
AND d.PartDescription LIKE '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test="query.spec != null and query.spec != ''">
|
|
AND d.Spec LIKE '%' + #{query.spec} + '%'
|
|
</if>
|
|
<if test="query.documentNo != null and query.documentNo != ''">
|
|
AND a.document_no LIKE '%' + #{query.documentNo} + '%'
|
|
</if>
|
|
<if test="query.orderNo != null and query.orderNo != ''">
|
|
AND a.order_no LIKE '%' + #{query.orderNo} + '%'
|
|
</if>
|
|
<if test="query.orderLineNo != null and query.orderLineNo != ''">
|
|
AND a.order_line_no LIKE '%' + #{query.orderLineNo} + '%'
|
|
</if>
|
|
<if test="query.syncedFlag != null and query.syncedFlag != ''">
|
|
AND a.synced_flag = #{query.syncedFlag}
|
|
</if>
|
|
<if test="query.startDate != null and query.startDate != ''">
|
|
AND a.transaction_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null and query.endDate != ''">
|
|
AND a.transaction_date < DATEADD(DAY, 1, #{query.endDate})
|
|
</if>
|
|
</select>
|
|
|
|
</mapper>
|
|
|