|
|
<?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.LabelQueryMapper">
<!-- 分页查询HandlingUnit标签信息 --> <select id="getHandlingUnitLabelList" resultType="com.gaotao.modules.handlingunit.entity.dto.HandlingUnitDto"> SELECT h.unit_id as unitId, h.site, h.part_no as partNo, h.part_desc as partDesc, h.batch_no as batchNo, h.location_id as locationId, h.warehouse_id as warehouseId, h.qty, h.in_stock_flag as inStockFlag, h.status, h.status_db as statusDb, h.created_date as createdDate, h.created_by as createdBy, h.modified_date as modifiedDate, h.modified_by as modifiedBy, h.print_count as printCount, h.last_print_date as lastPrintDate, h.printer_name as printerName, h.qr_code as qrCode, h.bar_code as barCode, h.remark, w.WareHouseName as warehouseName, l.LocationName as locationName, h.supplier_batch_no as supplierBatchNo, h.supplier_manufacture_date as supplierManufactureDate, h.height,h.wdr,h.eng_chg_level as engChgLevel,h.expired_date as expiredDate, h.count_flag as countFlag,h.last_count_date as lastCountDate,h.source_type as sourceType FROM handling_unit h WITH (NOLOCK) LEFT JOIN warehouse w WITH (NOLOCK) ON h.warehouse_id = w.WareHouseID AND h.site = w.Site LEFT JOIN location l WITH (NOLOCK) ON h.location_id = l.LocationID AND h.site = l.Site <where> <if test="params.site != null and params.site != ''"> AND h.site = #{params.site} </if> <if test="params.inStockFlag != null and params.inStockFlag != ''"> AND h.in_stock_flag = #{params.inStockFlag} </if> <!-- rqrq - 本期盘点 count_flag,仅 Y/N 入条件,空为全部 --> <if test="params.countFlag != null and params.countFlag != ''"> AND h.count_flag = #{params.countFlag} </if> <if test="params.partNo != null and params.partNo != ''"> AND h.part_no LIKE CONCAT('%', #{params.partNo}, '%') </if> <if test="params.batchNo != null and params.batchNo != ''"> AND h.batch_no LIKE CONCAT('%', #{params.batchNo}, '%') </if> <if test="params.locationId != null and params.locationId != ''"> AND h.location_id LIKE CONCAT('%', #{params.locationId}, '%') </if> <if test="params.unitId != null and params.unitId != ''"> AND h.unit_id LIKE CONCAT('%', #{params.unitId}, '%') </if> <if test="params.partDesc != null and params.partDesc != ''"> AND h.part_desc LIKE CONCAT('%', #{params.partDesc}, '%') </if> <if test="params.supplierBatchNo != null and params.supplierBatchNo != ''"> AND h.supplier_batch_no LIKE CONCAT('%', #{params.supplierBatchNo}, '%') </if> <if test="params.sourceType != null and params.sourceType != ''"> AND h.source_type = #{params.sourceType} </if> <if test=" params.startDate != null "> AND h.created_date >= #{params.startDate} </if> <if test=" params.endDate != null "> AND dateadd( DAY, 1, #{params.endDate} ) > h.created_date </if> </where> ORDER BY h.created_date DESC </select> <!-- rqrq - --> <select id="getHandlingUnitLabelListLocation" resultType="com.gaotao.modules.handlingunit.entity.dto.HandlingUnitDto">
SELECT h.unit_id AS unitId, h.site, h.part_no AS partNo, h.part_desc AS partDesc, h.batch_no AS batchNo, h.location_id AS locationId, h.warehouse_id AS warehouseId, h.qty, h.in_stock_flag AS inStockFlag, h.status, h.status_db AS statusDb, h.created_date AS createdDate, h.created_by AS createdBy, h.modified_date AS modifiedDate, h.modified_by AS modifiedBy, h.print_count AS printCount, h.last_print_date AS lastPrintDate, h.printer_name AS printerName, h.qr_code AS qrCode, h.bar_code AS barCode, p.remark, w.WareHouseName AS warehouseName, l.LocationName AS locationName, p.pallet_id, s.station_id, s.station_area, h.height, b.position, b.layer, p.calling_flag, p.wcs_location AS wcsLocation, h.count_flag AS countFlag, h.last_count_date AS lastCountDate, h.eng_chg_level AS engChgLevel, h.expired_date AS expiredDate, h.receive_date AS receiveDate, h.wdr FROM handling_unit h LEFT JOIN warehouse w ON h.warehouse_id = w.WareHouseID AND h.site = w.Site LEFT JOIN location l ON h.location_id = l.LocationID AND h.site = l.Site LEFT JOIN pallet_detail b ON h.unit_id = b.serial_no AND h.site = b.site LEFT JOIN pallet p ON b.pallet_id = p.pallet_id AND b.site = p.site LEFT JOIN agv_station s ON p.location_code = s.station_code <where> and p.pallet_id IS NOT NULL <if test="params.site != null and params.site != ''"> AND h.site = #{params.site} </if> <if test="params.inStockFlag != null and params.inStockFlag != ''"> AND h.in_stock_flag = #{params.inStockFlag} </if> <!-- rqrq - 本期盘点 count_flag,仅 Y/N 入条件,空为全部 --> <if test="params.countFlag != null and params.countFlag != ''"> AND h.count_flag = #{params.countFlag} </if> <if test="params.partNo != null and params.partNo != ''"> AND h.part_no LIKE '%' + #{params.partNo} + '%' </if> <if test="params.batchNo != null and params.batchNo != ''"> AND h.batch_no LIKE '%' + #{params.batchNo} + '%' </if> <if test="params.locationId != null and params.locationId != ''"> AND h.location_id LIKE '%' + #{params.locationId} + '%' </if> <if test="params.unitId != null and params.unitId != ''"> AND h.unit_id LIKE '%' + #{params.unitId} + '%' </if> <if test="params.partDesc != null and params.partDesc != ''"> AND h.part_desc LIKE '%' + #{params.partDesc} + '%' </if> <if test="params.palletId != null and params.palletId != ''"> AND p.pallet_id LIKE '%' + #{params.palletId} + '%' </if> <if test="params.stationId != null and params.stationId != ''"> AND s.station_id LIKE '%' + #{params.stationId} + '%' </if> </where> ORDER BY h.created_date DESC </select> <select id="getHandlingUnitLabelAll" resultType="com.gaotao.modules.handlingunit.entity.dto.HandlingUnitDto"> SELECT h.unit_id as unitId, h.site, h.part_no as partNo, h.part_desc as partDesc, h.batch_no as batchNo, h.location_id as locationId, h.warehouse_id as warehouseId, h.qty, h.in_stock_flag as inStockFlag, h.status, h.status_db as statusDb, h.created_date as createdDate, h.created_by as createdBy, h.modified_date as modifiedDate, h.modified_by as modifiedBy, h.print_count as printCount, h.last_print_date as lastPrintDate, h.printer_name as printerName, h.qr_code as qrCode, h.bar_code as barCode, h.remark, w.WareHouseName as warehouseName, l.LocationName as locationName, p.pallet_id, s.station_id, s.station_area, h.height, h.last_count_date as lastCountDate FROM handling_unit h WITH (NOLOCK) LEFT JOIN warehouse w WITH (NOLOCK) ON h.warehouse_id = w.WareHouseID AND h.site = w.Site LEFT JOIN location l WITH (NOLOCK) ON h.location_id = l.LocationID AND h.site = l.Site left join pallet_detail b WITH (NOLOCK) on h.unit_id = b.serial_no and h.site=b.site left join pallet p WITH (NOLOCK) on b.pallet_id = p.pallet_id and b.site = p.site left join agv_station s WITH (NOLOCK) on p.location_code=s.station_code
<where> <if test="params.site != null and params.site != ''"> AND h.site = #{params.site} </if> <if test="params.inStockFlag != null and params.inStockFlag != ''"> AND h.in_stock_flag = #{params.inStockFlag} </if> <if test="params.partNo != null and params.partNo != ''"> AND h.part_no LIKE CONCAT('%', #{params.partNo}, '%') </if> <if test="params.batchNo != null and params.batchNo != ''"> AND h.batch_no LIKE CONCAT('%', #{params.batchNo}, '%') </if> <if test="params.locationId != null and params.locationId != ''"> AND h.location_id LIKE CONCAT('%', #{params.locationId}, '%') </if> <if test="params.unitId != null and params.unitId != ''"> AND h.unit_id LIKE CONCAT('%', #{params.unitId}, '%') </if> <if test="params.partDesc != null and params.partDesc != ''"> AND h.part_desc LIKE CONCAT('%', #{params.partDesc}, '%') </if> <if test="params.partDesc != null and params.partDesc != ''"> AND h.part_desc LIKE CONCAT('%', #{params.partDesc}, '%') </if> <if test="params.palletId != null and params.palletId != ''"> AND p.pallet_id LIKE CONCAT('%', #{params.palletId}, '%') </if> <if test="params.stationId != null and params.stationId != ''"> AND s.station_id LIKE CONCAT('%', #{params.stationId}, '%') </if> </where> ORDER BY h.created_date DESC </select>
<!-- rqrq - 去除非栈板库存 --> <update id="removeNonPalletInventory"> UPDATE handling_unit SET in_stock_flag = 'N', epc = CONVERT(VARCHAR(8), GETDATE(), 112) WHERE unit_id NOT IN (SELECT serial_no FROM pallet_detail) AND in_stock_flag = 'Y' AND site = #{site} </update>
<!-- rqrq - 恢复非栈板库存 --> <update id="restoreNonPalletInventory"> UPDATE handling_unit SET in_stock_flag = 'Y', epc = '' WHERE epc = CONVERT(VARCHAR(8), GETDATE(), 112) AND in_stock_flag = 'N' AND site = #{site} </update>
</mapper>
|