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
6.5 KiB
202 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.spring.modules.material.dao.SeekByTransMapper">
|
|
<!-- 物料出入库查询-->
|
|
<select id="findAll" resultType="com.spring.modules.material.data.FindByTrans">
|
|
SELECT
|
|
a.site,
|
|
a.transNo,
|
|
a.transDate,
|
|
a.warehouseID,
|
|
c.partNo,
|
|
c.transQty,
|
|
c.batchNo,
|
|
c.locationID,
|
|
c.wdr_no,
|
|
c.manufactureDate,
|
|
a.orderRef1,
|
|
a.receiver,
|
|
a.enterDate,
|
|
a.userName,
|
|
a.transType,
|
|
d.part_desc,
|
|
c.itemNo,
|
|
(SELECT COUNT(*)
|
|
FROM TransDetailsub
|
|
WHERE transNo = a.transNo AND itemNo = c.itemNo) AS num
|
|
FROM
|
|
TransHeader AS a
|
|
LEFT JOIN TransDetail AS c ON a.Site = c.Site
|
|
AND a.TransNo = c.TransNo
|
|
LEFT JOIN part AS d ON d.part_no = c.partNo
|
|
<where>
|
|
<if test = "list.partNo != null and list.partNo != ''">
|
|
AND c.partNo = #{list.partNo}
|
|
</if>
|
|
<if test = "list.locationID != null and list.locationID != ''">
|
|
AND c.locationID = #{list.locationID}
|
|
</if>
|
|
<if test = "list.partDesc != null and list.partDesc != ''">
|
|
AND d.part_desc = #{list.partDesc}
|
|
</if>
|
|
<if test = "list.transType != null and list.transType != ''">
|
|
AND a.transType = #{list.transType}
|
|
</if>
|
|
<if test = "list.transNo != null and list.transNo != ''">
|
|
AND a.transNo = #{list.transNo}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="fingByRollNo" resultType="com.spring.modules.material.entity.TransDetailsub">
|
|
SELECT
|
|
TransNo,Site,SeqNo,itemNo,LocationID,BatchNo,BoxNo,RollNo,RollQty,orderRef1
|
|
FROM
|
|
TransDetailsub
|
|
WHERE
|
|
transNo = #{transNo}
|
|
AND itemNo = #{itemNo}
|
|
</select>
|
|
|
|
<!--库存清单查询-->
|
|
<select id="findByNum" resultType="com.spring.modules.material.data.FindByNum">
|
|
SELECT
|
|
a.Site,
|
|
a.partNo,
|
|
a.QtyOnHand,
|
|
a.batchNo,
|
|
a.locationID,
|
|
a.manufactureDate,
|
|
a.FirstInDate,
|
|
a.warehouseID,
|
|
b.part_desc,
|
|
a.expiredDate,
|
|
DATEDIFF(
|
|
DAY,
|
|
GETDATE(),
|
|
a.expiredDate
|
|
) AS daysUntilExpired
|
|
|
|
FROM
|
|
InventoryStock AS a
|
|
LEFT JOIN part AS b ON a.Site = b.Site
|
|
AND a.PartNo = b.part_no
|
|
<where>
|
|
<if test = "list.partNo != null and list.partNo != ''">
|
|
AND a.partNo = #{list.partNo}
|
|
</if>
|
|
<if test = "list.locationID != null and list.locationID != ''">
|
|
AND a.locationID = #{list.locationID}
|
|
</if>
|
|
<if test = "list.partDesc != null and list.partDesc != ''">
|
|
AND b.part_desc = #{list.partDesc}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="sendByTime" resultType="com.spring.modules.material.entity.TransDetail">
|
|
select trans_no ,expiredDate from TransDetail
|
|
</select>
|
|
|
|
<!-- 物料出入库按卷号查询-->
|
|
<select id="findByRoll" resultType="com.spring.modules.material.data.FindByRoll">
|
|
SELECT
|
|
a.site,
|
|
a.transNo,
|
|
a.transDate,
|
|
a.warehouseID,
|
|
b.rollNo,
|
|
c.partNo,
|
|
c.transQty,
|
|
c.batchNo,
|
|
c.locationID,
|
|
c.wdr_no,
|
|
c.manufactureDate,
|
|
a.orderRef1,
|
|
a.receiver,
|
|
a.enterDate,
|
|
a.userName,
|
|
a.transType,
|
|
d.part_desc,
|
|
c.itemNo
|
|
FROM
|
|
TransHeader AS a
|
|
LEFT JOIN TransDetail AS c ON a.Site = c.Site
|
|
AND a.TransNo = c.TransNo
|
|
|
|
LEFT JOIN part AS d ON d.part_no = c.partNo
|
|
|
|
LEFT JOIN TransDetailsub AS b ON b.Site = c.Site
|
|
AND b.TransNo = c.TransNo
|
|
<where>
|
|
<if test = "list.partNo != null and list.partNo != ''">
|
|
AND c.partNo = #{list.partNo}
|
|
</if>
|
|
<if test = "list.locationID != null and list.locationID != ''">
|
|
AND c.locationID = #{list.locationID}
|
|
</if>
|
|
<if test = "list.partDesc != null and list.partDesc != ''">
|
|
AND d.part_desc = #{list.partDesc}
|
|
</if>
|
|
<if test = "list.transType != null and list.transType != ''">
|
|
AND a.transType = #{list.transType}
|
|
</if>
|
|
<if test = "list.rollNo != null and list.rollNo != ''">
|
|
AND b.rollNo = #{list.rollNo}
|
|
</if>
|
|
<if test = "list.transNo != null and list.transNo != ''">
|
|
AND a.transNo = #{list.transNo}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="findByNumOrRollNo" resultType="com.spring.modules.material.data.FindByNumOrRollNo">
|
|
select RollNo,QtyOnHand,manufactureDate from InventoryStock_Roll
|
|
where Site = #{site}
|
|
AND WarehouseID = #{warehouseID}
|
|
AND PartNo = #{partNo}
|
|
AND BatchNo = #{batchNo}
|
|
AND LocationID = #{locationID}
|
|
</select>
|
|
<!-- 物料清单案卷号查询-->
|
|
<select id="findAllByRolls" resultType="com.spring.modules.material.data.FindAllByRolls">
|
|
SELECT
|
|
a.Site,
|
|
a.partNo,
|
|
a.QtyOnHand,
|
|
a.batchNo,
|
|
a.locationID,
|
|
a.manufactureDate,
|
|
a.FirstInDate,
|
|
a.warehouseID,
|
|
b.part_desc,
|
|
a.expiredDate,
|
|
a.RollNo,
|
|
DATEDIFF(
|
|
DAY,
|
|
GETDATE(),
|
|
a.expiredDate
|
|
) AS daysUntilExpired
|
|
FROM
|
|
InventoryStock_Roll AS a
|
|
LEFT JOIN part AS b ON a.Site = b.Site
|
|
AND a.PartNo = b.part_no
|
|
<where>
|
|
<if test = "list.partNo != null and list.partNo != ''">
|
|
AND a.partNo = #{list.partNo}
|
|
</if>
|
|
<if test = "list.locationID != null and list.locationID != ''">
|
|
AND a.locationID = #{list.locationID}
|
|
</if>
|
|
<if test = "list.partDesc != null and list.partDesc != ''">
|
|
AND b.part_desc = #{list.partDesc}
|
|
</if>
|
|
<if test = "list.RollNo != null and list.RollNo != ''">
|
|
AND a.RollNo = #{list.rollNo}
|
|
</if>
|
|
<if test = "list.qtyOnHand != null ">
|
|
AND a.QtyOnHand > #{list.qtyOnHand}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
</mapper>
|