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.
 
 
 
 
 
 

160 lines
7.7 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.wms.dao.WmsPrintDao">
<select id="getInboundQcResultData" resultType="InboundQcResultData">
select a.site,a.bu_no,a.order_no,a.order_status,b.part_no,b.part_desc,b.po_orderNo,b.po_itemNo,c.SupplierName,c.supplierID as supplierId,
b.inspector_date,b.submit_date,a.order_qty,roll_qty,roll_count,inspection_result,disposal_measures,
B.batch_qualified_qty,b.inspector_no
from inbound_notification_head a
inner join qc_iqc_record b on a.site = b.site and a.bu_no = b.bu_no and a.order_no = b.inspection_no AND A.order_type ='采购入库'
left join Supplier c on a.site = c.Site and a.Supplier_ID = c.supplierID
<where>
<if test="query.site != null and query.site != ''">
and A.site=#{query.site,jdbcType=VARCHAR}
</if>
<if test="query.buNo != null and query.buNo != ''">
and A.bu_no=#{query.buNo,jdbcType=CHAR}
</if>
<if test="query.orderNo != null and query.orderNo != ''">
and A.order_no like '%'+ #{query.orderNo,jdbcType=CHAR} +'%'
</if>
<if test="query.partNo != null and query.partNo != ''">
and b.part_no like '%'+ #{query.partNo,jdbcType=CHAR} +'%'
</if>
<if test="query.partDesc != null and query.partDesc != ''">
and b.part_desc like '%'+ #{query.partDesc,jdbcType=CHAR} +'%'
</if>
<if test="query.startDate != null">
and b.inspector_date > #{query.startDate}
</if>
<if test="query.endDate != null">
and #{query.endDate} > b.inspector_date
</if>
<if test="query.supplierName != null and query.supplierName != ''">
and c.SupplierName like '%'+ #{query.supplierName} +'%'
</if>
<if test="query.poOrderNo != null and query.poOrderNo != ''">
and b.po_orderNo like '%'+ #{query.poOrderNo} +'%'
</if>
<if test="query.poItemNo != null and query.poItemNo != ''">
and b.po_itemNo = #{query.supplierName}
</if>
</where>
</select>
<select id="getPoOrderRollNoOutData" resultType="PoOrderRollNoOutData">
select ROW_NUMBER() OVER (ORDER BY a.created_date) orderId,a.site,a.bu_no,a.inspection_no,a.order_no,a.item_no,a.roll_no,a.roll_qty,a.part_no,a.part_desc,a.supplier_id,a.supplier_name,
a.order_qty,a.created_by,a.created_date,a.update_by,a.updated_date,a.delflag,a.version,a.print_flag,a.citem_code,
a.citem_class,a.sendto_address,a.hardtag_in_flag,a.batch_no,a.production_date,a.validity_period,a.chip_disk_no,
a.expiration_warning_date,a.expiration_date
from po_order_roll_no a
<where>
and A.site=#{site}
and A.bu_no=#{buNo}
and A.inspection_no=#{inspectionNo,jdbcType=VARCHAR}
</where>
</select>
<select id="getInboundQcResultOtherData" resultType="PoOrderRollNoOutData">
select top 1 b.expiration_day,b.expiration_flag,b.exceed_in_ratio,b.expiration_warning_day,
isnull(a.batch_qualified_qty,0)-isnull((select sum(roll_qty) from po_order_roll_no where site=#{site} and bu_no=#{buNo} and inspection_no=#{orderNo} ),0) as remainingIssuableQty
from qc_iqc_record a
left join part b on a.site=b.site and a.bu_no=b.bu_No and a.part_no=b.PartNo
and a.inspection_no=#{orderNo} and a.site=#{site} and a.bu_no=#{buNo}
</select>
<insert id="savePoOrderRollNo">
insert into po_order_roll_no
(site,bu_no,inspection_no,order_no,item_no,roll_no,roll_qty,part_no,part_desc,supplier_id,supplier_name,order_qty,
created_by,created_date,delflag,version,print_flag,
hardtag_in_flag,batch_no,production_date,expiration_warning_date,expiration_date
) values
(#{site},#{buNo},#{inspectionNo},#{orderNo},#{itemNo},#{rollNo},#{rollQty},#{partNo},#{partDesc},#{supplierId},#{supplierName},#{orderQty},
#{createdBy},GetDate(),#{delflag},#{version},#{printFlag},
#{hardtagInFlag},#{batchNo},#{productionDate},#{expirationWarningDate},#{expirationDate})
</insert>
<delete id="deletePoPartLabelData">
delete from po_order_roll_no where site=#{site} and bu_no=#{buNo} and roll_no=#{rollNo} and inspection_no=#{inspectionNo}
</delete>
<update id="updatePrintFlag">
update po_order_roll_no set print_flag=isnull(print_flag,0)+1
WHERE
site = #{site} <!-- 先过滤 site -->
and bu_no=#{buNo}
AND roll_no IN
<foreach item="item" collection="rollList" open="(" separator="," close=")">
#{item.rollNo}
</foreach>
</update>
<select id="getPoPartLabelData" resultType="PoOrderRollNoOutData">
select site,bu_no,inspection_no,order_no,item_no,roll_no,roll_qty,part_no,part_desc,supplier_id,supplier_name,order_qty,
created_by,created_date,delflag,version,print_flag,
hardtag_in_flag,batch_no,production_date,expiration_warning_date,expiration_date
from po_order_roll_no
WHERE
site = #{site} <!-- 先过滤 site -->
and bu_no=#{buNo}
AND roll_no IN
<foreach item="item" collection="rollList" open="(" separator="," close=")">
#{item.rollNo}
</foreach>
order by created_date
</select>
<select id="getKuCunLabelData" resultType="InventoryStockOutData">
select a.site,a.bu_no,a.warehouse_id,location_id,roll_no,parent_roll_no,part_no,b.PartDescription,B.part_desc_en,a.status,a.qty_on_hand,label_type,a.orderref1,a.orderref2,a.orderref3,a.manufacture_date,a.expired_date,a.batch_no
from inventory_stock a
left join part b on a.site = b.site and a.bu_no = b.bu_no and a.part_no = b.PartNo
<where>
and a.status != '出库'
<if test="query.site != null and query.site != ''">
and A.site=#{query.site,jdbcType=VARCHAR}
</if>
<if test="query.buNo != null and query.buNo != ''">
and A.bu_no=#{query.buNo}
</if>
<if test="query.warehouseId != null and query.warehouseId != ''">
and A.warehouse_id like '%'+ #{query.warehouseId}+'%'
</if>
<if test="query.locationId != null and query.locationId != ''">
and A.location_id like '%'+ #{query.locationId}+'%'
</if>
<if test="query.rollNo != null and query.rollNo != ''">
and A.roll_no like '%'+ #{query.rollNo}+'%'
</if>
<if test="query.parentRollNo != null and query.parentRollNo != ''">
and A.parent_roll_no like '%'+ #{query.parentRollNo}+'%'
</if>
<if test="query.partNo != null and query.partNo != ''">
and A.part_no like '%'+ #{query.partNo}+'%'
</if>
<if test="query.partDescription != null and query.partDescription != ''">
and b.part_desc_en like '%'+ #{query.partDescEn}+'%'
</if>
<if test="query.status != null and query.status != ''">
and a.status = #{query.status}
</if>
<if test="query.labelType != null and query.labelType != ''">
and a.label_type = #{query.labelType}
</if>
<if test="query.batchNo != null and query.batchNo != ''">
and a.batch_no like '%'+ #{query.batchNo}+'%'
</if>
</where>
</select>
</mapper>