179 lines
8.1 KiB
XML
179 lines
8.1 KiB
XML
<?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.nflg.wms.repository.mapper.WmsPackageMapper">
|
|
<select id="getPackageContent" resultType="com.nflg.wms.common.pojo.vo.PackingItemPDAVO">
|
|
select a.id,
|
|
a.barcode_code,
|
|
sum(case when b.packaging_type = 0 then b.quantity else c.quantity end) as quantity,
|
|
b.material_code,
|
|
b.packaging_type,
|
|
b.po_number,
|
|
b.po_line_number,
|
|
b.delivery_no,
|
|
b.delivery_line_no,
|
|
a.create_user_name,
|
|
a.create_time,
|
|
b.unit,
|
|
b.serial_no,
|
|
b.batch_no,
|
|
b.material_description
|
|
from wms_package_item a
|
|
inner join wms_qr_code_master b on a.barcode_code = b.barcode_code and b.process_stage = 1
|
|
left join wms_qr_code_master c on b."id" = c.parent_barcode_id and c.process_stage = 1
|
|
where a.package_id = #{id}
|
|
group by a.id, a.barcode_code, b.material_code, b.packaging_type, b.po_number, b.po_line_number, b.delivery_no,
|
|
b.delivery_line_no, a.create_user_name, a.create_time, b.unit, b.serial_no, b.batch_no,
|
|
b.material_description
|
|
</select>
|
|
|
|
<select id="search" resultType="com.nflg.wms.common.pojo.vo.PackingVO">
|
|
select a.*,b.supplier_code,b.supplier_name from wms_package a
|
|
left join user_supplier b on a.supplier_id=b."id"
|
|
<where>
|
|
<if test="request.packingCode !=null and request.packingCode !=''">
|
|
and a.package_code ilike concat('%', #{request.packingCode}, '%')
|
|
</if>
|
|
<if test="request.packingName !=null and request.packingName !=''">
|
|
and a.package_name ilike concat('%', #{request.packingName}, '%')
|
|
</if>
|
|
<if test="request.supplierId !=null ">
|
|
and a.supplier_id = #{request.supplierId}
|
|
</if>
|
|
<if test="request.startDate !=null">
|
|
and a.create_time>= #{request.inStartDate}
|
|
</if>
|
|
<if test="request.endDate !=null">
|
|
and a.create_time <= #{request.inEndDate}
|
|
</if>
|
|
</where>
|
|
order by a.package_type asc, a.create_time desc
|
|
</select>
|
|
|
|
<select id="getChildPackageContent" resultType="com.nflg.wms.common.pojo.vo.PackingItemPDAVO">
|
|
select id,
|
|
barcode_code,
|
|
quantity,
|
|
material_code,
|
|
packaging_type,
|
|
po_number,
|
|
po_line_number,
|
|
delivery_no,
|
|
delivery_line_no,
|
|
create_user_name,
|
|
create_time,
|
|
unit,
|
|
serial_no,
|
|
batch_no,
|
|
material_description
|
|
from wms_qr_code_master
|
|
where parent_barcode_id = #{id}
|
|
</select>
|
|
|
|
<select id="getPackageInfo" resultType="com.nflg.wms.common.pojo.vo.PacageScanVO">
|
|
select a.id,
|
|
a.package_code,
|
|
a.package_name,
|
|
c.supplier_name,
|
|
min(case when e.is_disable_location = true then 0 else 1 end) as is_counting, a.package_status
|
|
from wms_package a
|
|
left join wms_package_item b on a.id = b.package_id
|
|
left join user_supplier c on a.supplier_id = c.id
|
|
left join wms_qr_code_master d on b.barcode_code = d.barcode_code
|
|
left join wms_warehouse e on d.storage_location = e."no"
|
|
where a.package_code = #{packageCode}
|
|
group by a.id, a.package_code, a.package_name, c.supplier_name, a.package_status
|
|
</select>
|
|
|
|
|
|
<select id="getPackageOrders" resultType="com.nflg.wms.common.pojo.vo.PacagePoVO">
|
|
select b.delivery_no,
|
|
c.supplier_name,
|
|
min(case when e.is_disable_location = true then 0 else 1 end) as is_counting
|
|
from wms_package a
|
|
left join wms_package_item b on a.id = b.package_id
|
|
left join user_supplier c on a.supplier_id = c.id
|
|
left join wms_qr_code_master d on b.barcode_code = d.barcode_code
|
|
left join wms_warehouse e on d.storage_location = e."no"
|
|
where a.id = #{id}
|
|
group by b.delivery_no, c.supplier_name
|
|
</select>
|
|
|
|
<select id="getPackageOrderItems" resultType="com.nflg.wms.common.pojo.vo.PacagePoItemVO">
|
|
select a.*, case when e.is_disable_location = true then 0 else 1 end as is_counting
|
|
from wms_srm_order_item a
|
|
left join wms_package_item b
|
|
on a.note_num = b.delivery_no and b.delivery_line_no = a.line_number
|
|
left join wms_qr_code_master d on b.barcode_code = d.barcode_code
|
|
left join wms_warehouse e on d.storage_location = e."no"
|
|
where a.note_num = #{deliveryNo}
|
|
and b.package_id = #{packageId}
|
|
</select>
|
|
|
|
<select id="getPendingScannings" resultType="com.nflg.wms.common.pojo.vo.PendingScanningVO">
|
|
select a.id as barcode_id,
|
|
a.barcode_code,
|
|
b.material_code,
|
|
b.material_description,
|
|
case when b.packaging_type = 0 then b.quantity else sum(f.quantity) end as packing_quantity,
|
|
b.unit,
|
|
c.supplier_name,
|
|
b.po_number,
|
|
b.po_line_number,
|
|
b.packaging_type,
|
|
f.parent_barcode_id,
|
|
b.delivery_no,
|
|
b.delivery_line_no,
|
|
min(case when e.is_disable_location = true then 0 else 1 end) as is_counting
|
|
from wms_package_item a
|
|
left join wms_qr_code_master b on a.barcode_code = b.barcode_code
|
|
left join wms_qr_code_master f on b.id = f.parent_barcode_id
|
|
left join wms_warehouse e on b.storage_location = e."no"
|
|
left join user_supplier c on b.supplier_code = c.supplier_code
|
|
where a.package_id = #{id}
|
|
group by a.id, a.barcode_code, b.material_code, b.material_description, b.quantity, b.unit, c.supplier_name,
|
|
b.po_number, b.po_line_number, b.packaging_type, f.parent_barcode_id, b.delivery_no, b.delivery_line_no
|
|
</select>
|
|
|
|
<select id="getPackageInfos" resultType="com.nflg.wms.common.pojo.vo.PacageScanVO">
|
|
select a.id,
|
|
a.package_code,
|
|
a.package_name,
|
|
c.supplier_name,
|
|
min(case when e.is_disable_location = true then 0 else 1 end) as is_counting, a.package_status
|
|
from wms_package a
|
|
left join wms_package_item b on a.id = b.package_id
|
|
left join user_supplier c on a.supplier_id = c.id
|
|
left join wms_qr_code_master d on b.barcode_code = d.barcode_code
|
|
left join wms_warehouse e on d.storage_location = e."no"
|
|
where a.id in
|
|
<foreach item="id" collection="barcodeIds" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
group by a.id, a.package_code, a.package_name, c.supplier_name, a.package_status
|
|
</select>
|
|
|
|
<select id="getScanningItems" resultType="com.nflg.wms.common.pojo.dto.PendingScanningItemDTO">
|
|
select a.id,
|
|
a.barcode_code,
|
|
b.quantity,
|
|
b.material_code,
|
|
b.packaging_type,
|
|
b.po_number,
|
|
b.po_line_number,
|
|
b.delivery_no,
|
|
b.delivery_line_no,
|
|
b.unit,
|
|
b.serial_no,
|
|
b.batch_no,
|
|
b.material_description,
|
|
c.id as srm_id
|
|
from wms_package_item a
|
|
left join wms_qr_code_master b on a.barcode_code = b.barcode_code
|
|
left join wms_srm_order_item c on b.delivery_no=c.note_num and b.delivery_line_no=c.line_number
|
|
where a.package_id in
|
|
<foreach item="id" collection="barcodeIds" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</select>
|
|
</mapper>
|