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.
 
 
 
 
 
 

202 lines
9.1 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,d.inspection_no as order_no,a.order_status,d.part_no,d.part_desc,D.related_order_no AS po_orderNo,D.related_order_line_no AS 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 inbound_notification_detail D on a.site = D.site and a.bu_no = D.bu_no and a.order_no = D.order_no AND A.order_type ='采购入库'
left join qc_iqc_record b on D.site = b.site and D.bu_no = b.bu_no and D.inspection_no = b.inspection_no
inner 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.roll_no,--标签条码
a.qty_on_hand,--标签数量
a.status,--状态
a.part_no,--物料编码
b.PartDescription,--物料名称
b.Spec,--规格型号
b.UMID,
UM.UMName,--单位名称
a.label_type,--标签类型
a.parent_roll_no, --上级标签号
a.parent_roll_type,--上级标签类型
a.warehouse_id,
W.WareHouseName,--仓库名称
a.location_id,
L.LocationName,--货位名称
a.first_in_date,--入库日期
a.manufacture_date,--生产日期
a.expired_date, --有效期
a.orderref0,--来源单据类型
a.orderref1,--来源单据号
a.orderref2,--来源单据行号
a.batch_no, --合约号码
a.wdr, --批次号
a.remark --备注说明
from inventory_stock a
LEFT JOIN PART b ON a.site = b.Site AND a.part_no = b.PartNo
LEFT JOIN UM ON b.Site = UM.Site AND b.UMID = UM.UMID
LEFT JOIN WareHouse W ON a.site = W.Site AND a.warehouse_id = W.WareHouseID
LEFT JOIN Location L ON a.site = L.Site AND a.location_id = L.LocationName
<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>
<!-- 更新库存标签属性 -->
<update id="updateInventoryStockAttribute">
UPDATE inventory_stock
SET
batch_no = #{batchNo,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR}
WHERE site = #{site,jdbcType=VARCHAR}
AND bu_no = #{buNo,jdbcType=VARCHAR}
AND roll_no = #{rollNo,jdbcType=VARCHAR}
</update>
</mapper>