ccl冷凝胶后端
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.
 
 
 
 
 
 

310 lines
13 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.shipment.mapper.ShipmentMapper">
<sql id="columns">
ifs.shipment_id,ifs.site,ifs.customer_no,ifs.customer_name,ifs.ship_date,sh.create_date
</sql>
<select id="selectShipmentList" resultType="com.spring.modules.shipment.entity.Shipment">
select <include refid="columns" /> from v_ifs_shipment ifs
inner join customer c on ifs.customer_no = c.customer_no and ifs.site = c.site
left join shipment_handle sh on ifs.shipment_id = sh.shipment_id and ifs.site = sh.site
<where>
<!-- and sh.create_date is null-->
<if test="site != null and site != ''">
and ifs.site = #{site}
</if>
<if test="shipmentId != null and shipmentId != ''">
and ifs.shipment_id like #{shipmentId}
</if>
<if test="startDate != null">
and ifs.ship_date >= #{startDate}
</if>
<if test="endDate != null">
and #{endDate} >= ifs.ship_date
</if>
<if test="status == '未装箱'">
and sh.create_date is null
</if>
<if test="status == '已出货'">
and sh.create_date is not null
</if>
<if test="status == '装箱中'">
and sh.create_date is null and EXISTS (
SELECT 1
FROM shipment_scan_box_catch ssbc
WHERE ssbc.site = ifs.site
AND ssbc.shipment_id = ifs.shipment_id
)
</if>
</where>
order by ifs.ship_date desc
</select>
<select id="selectShipmentPage" resultType="com.spring.modules.shipment.entity.Shipment">
select <include refid="columns" /> from v_ifs_shipment ifs
inner join customer c on ifs.customer_no = c.customer_no and ifs.site = c.site
left join shipment_handle sh on ifs.shipment_id = sh.shipment_id and ifs.site = sh.site
<where>
<!-- and sh.create_date is null-->
<if test="params.site != null and params.site != ''">
and ifs.site = #{params.site}
</if>
<if test="params.shipmentId != null and params.shipmentId != ''">
and ifs.shipment_id like #{params.shipmentId}
</if>
<if test="params.startDate != null">
and ifs.ship_date >= #{params.startDate}
</if>
<if test="params.endDate != null">
and #{params.endDate} >= ifs.ship_date
</if>
<if test="params.status == '未装箱'">
and sh.create_date is null
</if>
<if test="params.status == '已出货'">
and sh.create_date is not null
</if>
<if test="params.status == '装箱中'">
and sh.create_date is null and EXISTS (
SELECT 1
FROM shipment_scan_box_catch ssbc
WHERE ssbc.site = ifs.site
AND ssbc.shipment_id = ifs.shipment_id
)
</if>
</where>
order by ifs.ship_date desc
</select>
<select id="searchTransDetailsubCachData" resultType="com.spring.modules.material.data.TransDetailsubCachData">
select ssrc.site as Site,
ssrc.part_no as PartNo,
ssrc.roll_no as RollNo,
ssrc.location_id as LocationID,
ssrc.roll_qty as RollQty,
ssrc.batch_no as BatchNo,
ssrc.ref as wdrNo,
ssrc.location_id as LocationID,
ssrc.manufacturer_time as ManufactureDate,
ssrc.expiration_date as ExpiredDate,
ssrc.create_by as enterBy,
ssrc.create_time as enterDate,
ssbc.box_no_str as BoxNo,
dbo.get_part_desc(ssrc.site, ssrc.part_no) partDesc,
dbo.get_user_display(ssrc.create_by) enterByName
from shipment_scan_roll_catch ssrc
left join shipment_scan_box_catch ssbc on ssrc.site = ssbc.site and ssrc.shipment_id = ssbc.shipment_id and ssrc.box_no = ssbc.box_no
where ssrc.site = #{site}
and ssrc.shipment_id = #{shipmentId}
</select>
<select id="getDetailDataByCach" resultType="com.spring.modules.material.data.TransDetailData">
select a.site as Site,
#{trans.transNo} as TransNo,
a.part_no as PartNo,
a.location_id as LocationID,
sum(a.roll_qty) as TransQty,
'-' as Direction,
a.batch_no as BatchNo,
'N' as VitualPartFlag,
a.manufacturer_time as ManufactureDate,
a.expiration_date as ExpiredDate,
0 as StandCost,
0 as ActualCost,
0 as Price,
0 as Freight,
0 as Duty,
sum(a.roll_qty) as TransQty2,
a.create_by as enterBy,
a.ref as wdrNo
from shipment_scan_roll_catch a
where a.site = #{ship.site} and a.shipment_id = #{ship.shipmentId}
GROUP BY a.site,a.shipment_id,a.part_no,a.location_id,a.batch_no,a.manufacturer_time,a.expiration_date,A.create_by,a.ref
</select>
<insert id="saveShipmentHandle">
insert into shipment_handle(shipment_id, site, create_by, create_date)
values (#{shipmentId}, #{site}, #{createBy}, #{createDate})
</insert>
<select id="queryShipment" resultType="com.spring.modules.shipment.vo.ShipmentVo">
select <include refid="columns" /> from v_ifs_shipment ifs
left join shipment_handle sh on ifs.shipment_id = sh.shipment_id and ifs.site = sh.site
<where>
<!-- and sh.create_date is null-->
<if test="site != null and site != ''">
and ifs.site = #{site}
</if>
<if test="shipmentId != null and shipmentId != ''">
and ifs.shipment_id like #{shipmentId}
</if>
</where>
</select>
<select id="querySofinalRoll" resultType="com.spring.modules.schedule.data.SoFinalRollData">
select top 1
sf.id, sf.site,
sf.order_no,
sf.part_no,
sf.seq_no,
sf.final_roll_no,
sf.roll_qty,
sf.status_code,
sf.status,
sf.created_by,
sf.created_date,
sf.label_date,
sf.fqc_date,
sf.fqc_by,
sf.manufacture_date,
sf.rm_roll_no,
sf.expired_date,
sf.system_batch_no,
sf.raw_material_batch_no
from TransDetailsub td
left join so_final_roll sf on td.Site = sf.site and sf.final_roll_no = td.RollNo
<where>
<if test="shipmentId != null and shipmentId != ''">
and td.orderRef1 = #{shipmentId}
</if>
<if test="site != null and site != ''">
and td.Site = #{site}
</if>
<if test="partNo != null and partNo != ''">
and sf.part_no = #{partNo}
</if>
</where>
</select>
<select id="queryTransHeader" resultType="com.spring.modules.material.entity.TransHeader">
select top 1 TransNo,
Site,
WarehouseID,
TransDate,
TransType_DB,
TransType,
UserName,
Receiver,
TransYear,
TransMonth,
PartnerID,
PartnerName,
PartnerType,
AuthorizeFlag,
AuthorizeDate,
Authorizor,
TransferFlag,
TransferDate,
TransferGuys,
VoucherDate,
ProjectID,
ProjectName,
EnterDate,
Remark,
UseLocation,
OrderRef1,
LinkOrderFlag,
DelAddID,
Status
from TransHeader
where Site = #{site}
and OrderRef1 = #{shipmentId} and Status = '已录入' and TransType_DB = 'SP' and LinkOrderFlag = 'Y'
order by TransDate desc
</select>
<select id="queryTransDetail" resultType="com.spring.modules.material.entity.TransDetail">
select transno,
site,
itemno,
partno,
locationid,
transqty,
direction,
batchno,
standcost,
actualcost,
price,
freight,
duty,
orderref1,
orderref2,
orderref3,
orderref4,
orderref5,
remark,
vitualpartflag,
manufacturedate,
expireddate,
transqty2,
costgroupid,
orderreftype_db,
orderreftype,
wdr_no,
enterdate,
enterby
from TransDetail
where Site = #{site}
and TransNo = #{transNo}
</select>
<insert id="saveTransDetails">
insert into TransDetail(transno, site, itemno, partno, locationid, transqty, direction, batchno, standcost, actualcost, price, freight, duty, orderref1, orderref2, orderref3, orderref4, orderref5, remark, vitualpartflag, manufacturedate, expireddate, transqty2, costgroupid, orderreftype_db, orderreftype, wdr_no, enterdate, enterby)
values
<foreach collection="list" item="item" separator=",">
(#{item.transNo}, #{item.site}, #{item.itemNo}, #{item.partNo}, #{item.locationID}, #{item.transQty}, #{item.direction}, #{item.batchNo}, #{item.standCost}, #{item.actualCost}, #{item.price}, #{item.freight}, #{item.duty}, #{item.orderRef1}, #{item.orderRef2}, #{item.orderRef3}, #{item.orderRef4}, #{item.orderRef5}, #{item.remark}, #{item.vitualPartFlag}, #{item.manufactureDate}, #{item.expiredDate}, #{item.transQty2}, #{item.costGroupID}, #{item.orderRefTypeDb}, #{item.orderRefType}, #{item.wdrNo}, #{item.enterDate}, #{item.enterBy})
</foreach>
</insert>
<select id="queryTransDetailSub" resultType="com.spring.modules.material.entity.TransDetailsub">
select transno,
site,
seqno,
itemno,
locationid,
batchno,
boxno,
rollno,
rollqty,
orderref1,
orderref2,
orderref3,
orderref4,
orderref5,
remark
from TransDetailsub
where TransNo = #{transNo}
and Site = #{site}
</select>
<insert id="saveTransDetailSubs">
insert into TransDetailsub(transno, site, seqno, itemno, locationid, batchno, boxno, rollno, rollqty, orderref1, orderref2, orderref3, orderref4, orderref5, remark)
values
<foreach collection="list" item="item" separator=",">
(#{item.transNo}, #{item.site}, #{item.seqNo}, #{item.itemNo}, #{item.locationID}, #{item.batchNo}, #{item.boxNo}, #{item.rollNo}, #{item.rollQty}, #{item.orderRef1}, #{item.orderRef2}, #{item.orderRef3}, #{item.orderRef4}, #{item.orderRef5}, #{item.remark})
</foreach>
</insert>
<delete id="removeShipmentHandle">
delete from shipment_handle
where shipment_id = #{shipmentId} and site = #{site}
</delete>
<update id="updateTransHeader">
update TransHeader set Status = #{status},LinkOrderFlag = #{linkOrderFlag},Remark = #{remark} where Site = #{site} and TransNo = #{transNo}
</update>
<select id="getTransNo" resultType="java.lang.String">
select dbo.Get_TransNo(#{site},#{spr})
</select>
<update id="updateTransNo">
exec dbo.UpdateTransNo #{site},#{spr}
</update>
<insert id="saveTransHeader">
insert into TransHeader(transno, site, warehouseid, transdate, transtype_db, transtype, username, receiver, transyear, transmonth, partnerid, partnername, partnertype, authorizeflag, authorizedate, authorizor, transferflag, transferdate, transferguys, voucherdate, projectid, projectname, enterdate, remark, uselocation, orderref1, linkorderflag, deladdid, status)
values (#{transNo}, #{site}, #{warehouseID}, #{transDate}, #{transTypeDb}, #{transType}, #{userName}, #{receiver}, #{transYear,jdbcType=FLOAT}, #{transMonth,jdbcType=FLOAT}, #{partnerID}, #{partnerName}, #{partnerType}, #{authorizeFlag}, #{authorizeDate}, #{authorizor}, #{transferFlag}, #{transferDate}, #{transferGuys}, #{voucherDate}, #{projectID}, #{projectName}, #{enterDate}, #{remark}, #{useLocation}, #{orderRef1}, #{linkOrderFlag}, #{delAddID}, #{status})
</insert>
</mapper>