You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

442 lines
22 KiB
XML

<?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.op.wms.mapper.WmsFpStorageNewsSnMapper">
<resultMap type="WmsFpStorageNewsSn" id="WmsFpStorageNewsSnResult">
<result property="storageId" column="storage_id"/>
<result property="whCode" column="wh_code"/>
<result property="waCode" column="wa_code"/>
<result property="wlCode" column="wl_code"/>
<result property="orderNo" column="order_no"/>
<result property="productName" column="product_name"/>
<result property="productCode" column="product_code"/>
<result property="sn" column="sn"/>
<result property="barCode" column="bar_code"/>
<result property="amount" column="amount"/>
<result property="batchNumber" column="batch_number"/>
<result property="userDefined2" column="user_defined2"/>
<result property="userDefined3" column="user_defined3"/>
<result property="userDefined4" column="user_defined4"/>
<result property="userDefined5" column="user_defined5"/>
<result property="userDefined6" column="user_defined6"/>
<result property="userDefined7" column="user_defined7"/>
<result property="userDefined8" column="user_defined8"/>
<result property="userDefined9" column="user_defined9"/>
<result property="userDefined10" column="user_defined10"/>
<result property="createBy" column="create_by"/>
<result property="gmtCreate" column="gmt_create"/>
<result property="lastModifiedBy" column="last_modified_by"/>
<result property="gmtModified" column="gmt_modified"/>
<result property="activeFlag" column="active_flag"/>
<result property="factoryCode" column="factory_code"/>
<result property="sapFactoryCode" column="sap_factory_code"/>
</resultMap>
<sql id="selectWmsFpStorageNewsSnVo">
select storage_id, wh_code, wa_code, wl_code, order_no, product_name, product_code, sn, bar_code, amount, batch_number, user_defined2, user_defined3, user_defined4, user_defined5, user_defined6, user_defined7, user_defined8, user_defined9, user_defined10, create_by, gmt_create, last_modified_by, gmt_modified, active_flag, factory_code, sap_factory_code from wms_fp_storage_news_sn
</sql>
<select id="selectWmsFpStorageNewsSnList" parameterType="WmsFpStorageNewsSn" resultMap="WmsFpStorageNewsSnResult">
<include refid="selectWmsFpStorageNewsSnVo"/>
<where>
<if test="whCode != null and whCode != ''">and wh_code = #{whCode}</if>
<if test="waCode != null and waCode != ''">and wa_code = #{waCode}</if>
<if test="wlCode != null and wlCode != ''">and wl_code = #{wlCode}</if>
<if test="orderNo != null and orderNo != ''">and order_no = #{orderNo}</if>
<if test="productName != null and productName != ''">and product_name like concat('%', #{productName},
'%')
</if>
<if test="productCode != null and productCode != ''">and product_code like concat('%',#{productCode} ,
'%')</if>
<if test="sn != null and sn != ''">and sn = #{sn}</if>
<if test="barCode != null and barCode != ''">and bar_code = #{barCode}</if>
<if test="amount != null ">and amount = #{amount}</if>
<if test="batchNumber != null and batchNumber != ''">and batch_number = #{batchNumber}</if>
<if test="userDefined2 != null and userDefined2 != ''">and user_defined2 = #{userDefined2}</if>
<if test="userDefined3 != null and userDefined3 != ''">and user_defined3 = #{userDefined3}</if>
<if test="userDefined4 != null and userDefined4 != ''">and user_defined4 = #{userDefined4}</if>
<if test="userDefined5 != null and userDefined5 != ''">and user_defined5 = #{userDefined5}</if>
<if test="userDefined6 != null and userDefined6 != ''">and user_defined6 = #{userDefined6}</if>
<if test="userDefined7 != null and userDefined7 != ''">and user_defined7 = #{userDefined7}</if>
<if test="userDefined8 != null and userDefined8 != ''">and user_defined8 = #{userDefined8}</if>
<if test="userDefined9 != null and userDefined9 != ''">and user_defined9 = #{userDefined9}</if>
<if test="userDefined10 != null and userDefined10 != ''">and user_defined10 = #{userDefined10}</if>
<if test="gmtCreate != null ">and gmt_create = #{gmtCreate}</if>
<if test="lastModifiedBy != null and lastModifiedBy != ''">and last_modified_by = #{lastModifiedBy}</if>
<if test="gmtModified != null ">and gmt_modified = #{gmtModified}</if>
<if test="activeFlag != null and activeFlag != ''">and active_flag = #{activeFlag}</if>
<if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if>
<if test="sapFactoryCode != null and sapFactoryCode != ''">and sap_factory_code = #{sapFactoryCode}</if>
</where>
</select>
<select id="selectBSKList" parameterType="WmsFpStorageNewsSn" resultMap="WmsFpStorageNewsSnResult">
SELECT
storage_id,
wh_code,
wa_code,
wl_code,
order_no,
product_name,
product_code,
sn,
bar_code,
amount,
batch_number,
user_defined2,
user_defined3,
user_defined4,
user_defined5,
user_defined6,
user_defined7,
user_defined8,
user_defined9,
user_defined10,
create_by,
gmt_create,
last_modified_by,
gmt_modified,
active_flag,
factory_code,
sap_factory_code
FROM
wms_fp_storage_news_sn_copy1
<where>
<if test="whCode != null and whCode != ''">and wh_code = #{whCode}</if>
<if test="waCode != null and waCode != ''">and wa_code = #{waCode}</if>
<if test="wlCode != null and wlCode != ''">and wl_code = #{wlCode}</if>
<if test="orderNo != null and orderNo != ''">and order_no = #{orderNo}</if>
<if test="productName != null and productName != ''">and product_name like concat('%', #{productName},
'%')
</if>
<if test="productCode != null and productCode != ''">and product_code = #{productCode}</if>
<if test="sn != null and sn != ''">and sn = #{sn}</if>
<if test="barCode != null and barCode != ''">and bar_code = #{barCode}</if>
<if test="amount != null ">and amount = #{amount}</if>
<if test="batchNumber != null and batchNumber != ''">and batch_number = #{batchNumber}</if>
<if test="userDefined2 != null and userDefined2 != ''">and user_defined2 = #{userDefined2}</if>
<if test="userDefined3 != null and userDefined3 != ''">and user_defined3 = #{userDefined3}</if>
<if test="userDefined4 != null and userDefined4 != ''">and user_defined4 = #{userDefined4}</if>
<if test="userDefined5 != null and userDefined5 != ''">and user_defined5 = #{userDefined5}</if>
<if test="userDefined6 != null and userDefined6 != ''">and user_defined6 = #{userDefined6}</if>
<if test="userDefined7 != null and userDefined7 != ''">and user_defined7 = #{userDefined7}</if>
<if test="userDefined8 != null and userDefined8 != ''">and user_defined8 = #{userDefined8}</if>
<if test="userDefined9 != null and userDefined9 != ''">and user_defined9 = #{userDefined9}</if>
<if test="userDefined10 != null and userDefined10 != ''">and user_defined10 = #{userDefined10}</if>
<if test="gmtCreate != null ">and gmt_create = #{gmtCreate}</if>
<if test="lastModifiedBy != null and lastModifiedBy != ''">and last_modified_by = #{lastModifiedBy}</if>
<if test="gmtModified != null ">and gmt_modified = #{gmtModified}</if>
<if test="activeFlag != null and activeFlag != ''">and active_flag = #{activeFlag}</if>
<if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if>
<if test="sapFactoryCode != null and sapFactoryCode != ''">and sap_factory_code = #{sapFactoryCode}</if>
</where>
</select>
<select id="selectWmsFpStorageNewsSnByStorageId" parameterType="String" resultMap="WmsFpStorageNewsSnResult">
<include refid="selectWmsFpStorageNewsSnVo"/>
where storage_id = #{storageId}
</select>
<!-- 根据库位,托盘号,产品编码查询库存主表-->
<select id="selectWmsFpStorageNewsSnBySnAndProductCodeAndWlCode" resultMap="WmsFpStorageNewsSnResult">
SELECT
active_flag,
amount,
bar_code,
create_by,
factory_code,
gmt_create,
gmt_modified,
last_modified_by,
order_no,
product_name,
sap_factory_code,
storage_id,
batch_number,
user_defined10,
user_defined2,
user_defined3,
user_defined4,
user_defined5,
user_defined6,
user_defined7,
user_defined8,
user_defined9,
wa_code,
wh_code
FROM
wms_fp_storage_news_sn
WHERE
product_code = #{productCode} AND
sn = #{sn} and wl_code = #{wlCode}
</select>
<!-- 根据托盘号和产品编码查询-->
<select id="selectWmsFpStorageNewsSnBySnAndProductCode" resultMap="WmsFpStorageNewsSnResult">
SELECT
active_flag,
amount,
bar_code,
create_by,
factory_code,
gmt_create,
gmt_modified,
last_modified_by,
order_no,
product_name,
sap_factory_code,
storage_id,
batch_number,
user_defined10,
user_defined2,
user_defined3,
user_defined4,
user_defined5,
user_defined6,
user_defined7,
user_defined8,
user_defined9,
wa_code,
wh_code,
wl_code
FROM
wms_fp_storage_news_sn
WHERE
product_code = #{productCode} AND
sn = #{sn}
</select>
<insert id="insertWmsFpStorageNewsSn" parameterType="WmsFpStorageNewsSn">
insert into wms_fp_storage_news_sn
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="storageId != null">storage_id,</if>
<if test="whCode != null">wh_code,</if>
<if test="waCode != null">wa_code,</if>
<if test="wlCode != null">wl_code,</if>
<if test="orderNo != null">order_no,</if>
<if test="productName != null">product_name,</if>
<if test="productCode != null">product_code,</if>
<if test="sn != null">sn,</if>
<if test="barCode != null">bar_code,</if>
<if test="amount != null">amount,</if>
<if test="batchNumber != null">batch_number,</if>
<if test="userDefined2 != null">user_defined2,</if>
<if test="userDefined3 != null">user_defined3,</if>
<if test="userDefined4 != null">user_defined4,</if>
<if test="userDefined5 != null">user_defined5,</if>
<if test="userDefined6 != null">user_defined6,</if>
<if test="userDefined7 != null">user_defined7,</if>
<if test="userDefined8 != null">user_defined8,</if>
<if test="userDefined9 != null">user_defined9,</if>
<if test="userDefined10 != null">user_defined10,</if>
<if test="createBy != null">create_by,</if>
<if test="gmtCreate != null">gmt_create,</if>
<if test="lastModifiedBy != null">last_modified_by,</if>
<if test="gmtModified != null">gmt_modified,</if>
<if test="activeFlag != null">active_flag,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="sapFactoryCode != null">sap_factory_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="storageId != null">#{storageId},</if>
<if test="whCode != null">#{whCode},</if>
<if test="waCode != null">#{waCode},</if>
<if test="wlCode != null">#{wlCode},</if>
<if test="orderNo != null">#{orderNo},</if>
<if test="productName != null">#{productName},</if>
<if test="productCode != null">#{productCode},</if>
<if test="sn != null">#{sn},</if>
<if test="barCode != null">#{barCode},</if>
<if test="amount != null">#{amount},</if>
<if test="batchNumber != null">#{batchNumber},</if>
<if test="userDefined2 != null">#{userDefined2},</if>
<if test="userDefined3 != null">#{userDefined3},</if>
<if test="userDefined4 != null">#{userDefined4},</if>
<if test="userDefined5 != null">#{userDefined5},</if>
<if test="userDefined6 != null">#{userDefined6},</if>
<if test="userDefined7 != null">#{userDefined7},</if>
<if test="userDefined8 != null">#{userDefined8},</if>
<if test="userDefined9 != null">#{userDefined9},</if>
<if test="userDefined10 != null">#{userDefined10},</if>
<if test="createBy != null">#{createBy},</if>
<if test="gmtCreate != null">#{gmtCreate},</if>
<if test="lastModifiedBy != null">#{lastModifiedBy},</if>
<if test="gmtModified != null">#{gmtModified},</if>
<if test="activeFlag != null">#{activeFlag},</if>
<if test="factoryCode != null">#{factoryCode},</if>
<if test="sapFactoryCode != null">#{sapFactoryCode},</if>
</trim>
</insert>
<update id="updateWmsFpStorageNewsSn" parameterType="WmsFpStorageNewsSn">
update wms_fp_storage_news_sn
<trim prefix="SET" suffixOverrides=",">
<if test="whCode != null">wh_code = #{whCode},</if>
<if test="waCode != null">wa_code = #{waCode},</if>
<if test="wlCode != null">wl_code = #{wlCode},</if>
<if test="orderNo != null">order_no = #{orderNo},</if>
<if test="productName != null">product_name = #{productName},</if>
<if test="productCode != null">product_code = #{productCode},</if>
<if test="sn != null">sn = #{sn},</if>
<if test="barCode != null">bar_code = #{barCode},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="batchNumber != null">batch_number = #{batchNumber},</if>
<if test="userDefined2 != null">user_defined2 = #{userDefined2},</if>
<if test="userDefined3 != null">user_defined3 = #{userDefined3},</if>
<if test="userDefined4 != null">user_defined4 = #{userDefined4},</if>
<if test="userDefined5 != null">user_defined5 = #{userDefined5},</if>
<if test="userDefined6 != null">user_defined6 = #{userDefined6},</if>
<if test="userDefined7 != null">user_defined7 = #{userDefined7},</if>
<if test="userDefined8 != null">user_defined8 = #{userDefined8},</if>
<if test="userDefined9 != null">user_defined9 = #{userDefined9},</if>
<if test="userDefined10 != null">user_defined10 = #{userDefined10},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="lastModifiedBy != null">last_modified_by = #{lastModifiedBy},</if>
<if test="gmtModified != null">gmt_modified = #{gmtModified},</if>
<if test="activeFlag != null">active_flag = #{activeFlag},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="sapFactoryCode != null">sap_factory_code = #{sapFactoryCode},</if>
</trim>
where storage_id = #{storageId}
</update>
<delete id="deleteWmsFpStorageNewsSnByStorageId" parameterType="String">
delete from wms_fp_storage_news_sn where storage_id = #{storageId}
</delete>
<delete id="deleteWmsFpStorageNewsSnByStorageIds" parameterType="String">
delete from wms_fp_storage_news_sn where storage_id in
<foreach item="storageId" collection="array" open="(" separator="," close=")">
#{storageId}
</foreach>
</delete>
<update id="updateWmsFpStorageNewsSnOut">
update wms_fp_storage_news_sn
set user_defined2 = COALESCE(user_defined2, 0) + 1
where sn=#{sn} and active_flag='1'
</update>
<select id="selectwmsFpStorageNews" resultType="java.lang.String">
select DISTINCT user_defined1 from wms_fp_storage_news where product_code=#{productCode} and active_flag='1'
</select>
<select id="selectBSKId" resultMap="WmsFpStorageNewsSnResult">
SELECT
wms_fp_storage_news_sn_copy1.storage_id,
wms_fp_storage_news_sn_copy1.wh_code,
wms_fp_storage_news_sn_copy1.wa_code,
wms_fp_storage_news_sn_copy1.wl_code,
wms_fp_storage_news_sn_copy1.order_no,
wms_fp_storage_news_sn_copy1.product_name,
wms_fp_storage_news_sn_copy1.product_code,
wms_fp_storage_news_sn_copy1.sn,
wms_fp_storage_news_sn_copy1.bar_code,
wms_fp_storage_news_sn_copy1.amount,
wms_fp_storage_news_sn_copy1.batch_number,
wms_fp_storage_news_sn_copy1.user_defined2,
wms_fp_storage_news_sn_copy1.user_defined3,
wms_fp_storage_news_sn_copy1.user_defined4,
wms_fp_storage_news_sn_copy1.user_defined5,
wms_fp_storage_news_sn_copy1.user_defined6,
wms_fp_storage_news_sn_copy1.user_defined7,
wms_fp_storage_news_sn_copy1.user_defined8,
wms_fp_storage_news_sn_copy1.user_defined9,
wms_fp_storage_news_sn_copy1.create_by,
wms_fp_storage_news_sn_copy1.gmt_create,
wms_fp_storage_news_sn_copy1.last_modified_by,
wms_fp_storage_news_sn_copy1.gmt_modified,
wms_fp_storage_news_sn_copy1.active_flag,
wms_fp_storage_news_sn_copy1.factory_code,
COALESCE(base.umrez, 0) AS user_defined10,
wms_fp_storage_news_sn_copy1.sap_factory_code
FROM
wms_fp_storage_news_sn_copy1
LEFT JOIN base_product base ON base.product_code LIKE concat ( '%', wms_fp_storage_news_sn_copy1.product_code, '%' )
WHERE
storage_id = #{workorderId}
</select>
<select id="selectBSKIdlist" resultMap="WmsFpStorageNewsSnResult">
SELECT
storage_id,
wh_code,
wa_code,
wl_code,
order_no,
product_name,
product_code,
sn,
bar_code,
amount,
batch_number,
user_defined2,
user_defined3,
user_defined4,
user_defined5,
user_defined6,
user_defined7,
user_defined8,
user_defined9,
user_defined10,
create_by,
gmt_create,
last_modified_by,
gmt_modified,
active_flag,
factory_code,
sap_factory_code
FROM
wms_fp_storage_news_sn_copy1_copy1
where user_defined4=#{workorderId}
</select>
<insert id="addBatchPallet" parameterType="java.util.List">
<foreach collection="list" item="dto" separator=";">
<!-- 插入数据到 wms_fp_storage_news_sn_copy1_copy1 表 -->
insert into wms_fp_storage_news_sn_copy1_copy1
<!-- 使用 <trim> 标签来处理列名,这样可以自动去掉最后一个逗号 -->
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dto.workorderId != null">storage_id,</if>
<if test="dto.waCode != null">wa_code,</if>
<if test="dto.workorderCode != null">order_no,</if>
<if test="dto.productName != null">product_name,</if>
<if test="dto.productCode != null">product_code,</if>
<if test="dto.sn != null">sn,</if>
<if test="dto.batchQuantity != null">amount,</if>
<if test="dto.batchCode != null">batch_number,</if>
<if test="dto.attr4 != null">user_defined4,</if>
<if test="dto.productDateStr != null">user_defined5,</if>
<if test="dto.unit != null">user_defined6,</if>
<if test="dto.palletNo != null">user_defined7,</if>
<if test="dto.palletCode != null">user_defined8,</if>
<if test="dto.umrez != null">user_defined9,</if>
<if test="dto.createBy != null">create_by,</if>
<if test="dto.createTime != null">gmt_create,</if>
<if test="dto.factoryCode != null">factory_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dto.workorderId != null">#{dto.workorderId},</if>
<if test="dto.waCode != null">#{dto.waCode},</if>
<if test="dto.workorderCode != null">#{dto.workorderCode},</if>
<if test="dto.productName != null">#{dto.productName},</if>
<if test="dto.productCode != null">#{dto.productCode},</if>
<if test="dto.sn != null">#{dto.sn},</if>
<if test="dto.batchQuantity != null">#{dto.batchQuantity},</if>
<if test="dto.batchCode != null">#{dto.batchCode},</if>
<if test="dto.attr4 != null">#{dto.attr4},</if>
<if test="dto.productDateStr != null">#{dto.productDateStr},</if>
<if test="dto.unit != null">#{dto.unit},</if>
<if test="dto.palletNo != null">#{dto.palletNo},</if>
<if test="dto.palletCode != null">#{dto.palletCode},</if>
<if test="dto.umrez != null">#{dto.umrez},</if>
<if test="dto.createBy != null">#{dto.createBy},</if>
<if test="dto.createTime != null">#{dto.createTime},</if>
<if test="dto.factoryCode != null">#{dto.factoryCode},</if>
</trim>
</foreach>
</insert>
</mapper>