荣鑫后端
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.
 
 
 
 
 
 

266 lines
9.0 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.finishedProduct.dao.SoReceiveBoxesDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.gaotao.modules.finishedProduct.entity.SoReceiveBoxesEntity" id="soReceiveBoxesMap">
<result property="id" column="id"/>
<result property="site" column="site"/>
<result property="boxNo" column="box_no"/>
<result property="orderNo" column="order_no"/>
<result property="batchCode" column="batch_code"/>
<result property="itemCode" column="item_code"/>
<result property="status" column="status"/>
<result property="status2" column="status2"/>
<result property="rollsQty" column="rolls_qty"/>
<result property="boxType" column="box_type"/>
<result property="cInStockFlag" column="c_in_stock_flag"/>
<result property="cType" column="c_type"/>
<result property="createdDate" column="created_date"/>
<result property="createdBy" column="created_by"/>
<result property="updateDate" column="update_date"/>
<result property="updateBy" column="update_by"/>
<result property="delflag" column="delflag"/>
<result property="version" column="version"/>
</resultMap>
<update id="sealing">
update so_receive_boxes
set status='已封箱'
where order_no = #{orderNo}
and item_code = #{partNo}
and status = '未封箱'
</update>
<select id="boxingNumberByOrderNoAndPartNo" resultType="java.lang.Double">
SELECT ISNULL(sum(roll_qty), 0)
FROM so_receive_box_rolls r
LEFT JOIN so_receive_boxes b on b.box_no = r.box_no
WHERE b.order_no = #{orderNo}
and b.item_code = #{partNo}
</select>
<select id="getBoxingRoll" resultType="com.gaotao.modules.finishedProduct.entity.SoReceiveBoxRollsEntity">
SELECT id,
site,
box_no,
final_roll_no,
roll_qty,
created_date,
created_by,
update_date,
update_by,
delflag,
version,
erp_flag,
remark
FROM so_receive_box_rolls
WHERE final_roll_no = #{rollNo}
</select>
<select id="getBoxing" resultType="com.gaotao.modules.finishedProduct.entity.SoReceiveBoxesEntity">
SELECT id,
site,
box_no,
order_no,
batch_code,
item_code,
status,
status2,
rolls_qty,
box_type,
c_in_stock_flag,
c_type,
created_date,
created_by,
update_date,
update_by,
delflag,
version
FROM so_receive_boxes
WHERE order_no = #{orderNo}
and item_code = #{partNo}
and status = '未封箱'
</select>
<select id="getBoxRollList" resultType="com.gaotao.modules.finishedProduct.entity.CRollinfoEntity">
SELECT cr.*
FROM so_receive_box_rolls br
LEFT JOIN so_receive_boxes bx on br.box_no = bx.box_no
LEFT JOIN C_RollInfo cr ON br.final_roll_no = cr.RollNo
WHERE bx.order_no = #{orderNo}
</select>
<select id="sealingNumber" resultType="com.gaotao.modules.finishedProduct.vo.BoxVo">
SELECT sum(r.roll_qty) number ,b.box_no
FROM so_receive_boxes b
LEFT JOIN so_receive_box_rolls r on r.box_no = b.box_no
where order_no = #{orderNo}
and item_code = #{partNo}
and status = '未封箱'
group by b.box_no
</select>
<select id="getSoBoxingList" resultType="com.gaotao.modules.finishedProduct.vo.SoReceiveBoxesEntityVo">
select id,
site,
box_no,
order_no,
batch_code,
item_code,
status,
status2,
dbo.GET_BOXING_ROLLSQTY(box_no) as rolls_qty,
box_type,
c_in_stock_flag,
c_type,
created_date,
created_by,
update_date,
update_by,
delflag,
version
from so_receive_boxes
<where>
<if test="boxNo != null and boxNo!= ''">
and box_no like #{boxNo}
</if>
<if test="site != null and site!= ''">
and site like #{site}
</if>
<if test="orderNo != null and orderNo!= ''">
and order_no like #{orderNo}
</if>
<if test="boxNo != null and boxNo!= ''">
and box_no like #{boxNo}
</if>
<if test="itemCode != null and itemCode!= ''">
and item_code like #{itemCode}
</if>
<if test="status != null and status!= ''">
and status like #{status}
</if>
<if test="startDate != null ">
and created_date <![CDATA[>=]]> #{createdDate}
</if>
<if test="endDate != null ">
and created_date <![CDATA[<=]]> #{endDate}
</if>
<if test="createdBy != null and createdBy!= ''">
and created_by = #{createdBy}
</if>
</where>
</select>
<select id="searchBoxRolls" resultType="com.gaotao.modules.finishedProduct.entity.SoReceiveBoxRollsEntity">
SELECT
r.id,
r.site,
r.box_no,
r.final_roll_no,
r.roll_qty,
r.created_date,
r.created_by,
r.update_date,
r.update_by,
r.delflag,
r.version,
r.erp_flag,
r.remark,
b.item_code,
b.order_no
FROM so_receive_box_rolls r
left join so_receive_boxes b on r.box_no = b.box_no
where b.box_no = #{boxNo}
<where>
<if test="finalRollNo != null and finalRollNo != ''">
and r.final_roll_no = #{finalRollNo}
</if>
</where>
</select>
<select id="getBoxNoByRollNo"
resultType="com.gaotao.modules.finishedProduct.entity.SoReceiveBoxRollsEntity">
select box_no
from so_receive_box_rolls
where final_roll_no = #{finalRollNo}
</select>
<select id="getBoxByRollNo" resultType="com.gaotao.modules.finishedProduct.entity.SoReceiveBoxesEntity">
SELECT sob.id,
sob.site,
sob.box_no,
sob.order_no,
sob.batch_code,
sob.item_code,
sob.status,
sob.status2,
sob.rolls_qty,
sob.box_type,
sob.c_in_stock_flag,
sob.c_type,
sob.created_date,
sob.created_by,
sob.update_date,
sob.update_by,
sob.delflag,
sob.version
FROM so_receive_boxes sob
LEFT JOIN so_receive_box_rolls sbr ON sob.box_no = sbr.box_no
WHERE final_roll_no = #{finalRollNo}
</select>
<select id="getBoxByOrderAndItemCode"
resultType="com.gaotao.modules.finishedProduct.entity.SoReceiveBoxesEntity">
SELECT site,
box_no,
order_no,
batch_code,
item_code,
status,
status2,
rolls_qty,
box_type,
c_in_stock_flag,
c_type,
created_date,
created_by,
update_date,
update_by,
delflag,
version
FROM so_receive_boxes
WHERE order_no = #{ orderNo }
and item_code = #{itemCode}
AND Status = '未封箱'
</select>
<select id="getLotNo" resultType="java.lang.String">
SELECT
top 1 cr.OrderRef1
FROM
so_receive_box_rolls sr
LEFT JOIN C_RollInfo cr on cr.RollNo = sr.final_roll_no
where sr.box_no = #{boxNo} and cr.OrderRef1 is not null
</select>
<select id="getOrderPartQtyList" resultType="com.gaotao.modules.finishedProduct.vo.OrderPartQtyVo">
select order_no,item_code as part_no,sum(r.roll_qty) as part_qty from
so_receive_boxes b
LEFT JOIN so_receive_box_rolls r on r.box_no = b.box_no
where b.order_no = #{orderNo}
group by order_no,item_code
</select>
<select id="getRollOrderNo" resultType="com.gaotao.modules.finishedProduct.entity.CRollinfoEntity">
SELECT top 1 cr.OrderRef1
FROM so_receive_box_rolls sbr
LEFT JOIN so_receive_boxes sb on sb.box_no = sbr.box_no
LEFT JOIN C_RollInfo cr on cr.RollNo = sbr.final_roll_no
WHERE item_code = #{partno} and sb.order_no = #{orderNo}
and sb.status = '未封箱'
</select>
</mapper>