wms_snN7pp_nantong/wms-business/target/classes/mapper/TMiStockMapper.xml
2024-08-21 10:13:13 +08:00

368 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.ruoyi.business.mapper.TMiStockMapper">
<resultMap type="TMiStock" id="TMiStockResult">
<result property="stockId" column="STOCK_ID" />
<result property="putinId" column="PUTIN_ID" />
<result property="storageId" column="STORAGE_ID" />
<result property="areaId" column="AREA_ID" />
<result property="locationId" column="LOCATION_ID" />
<result property="goodsTypeid" column="GOODS_TYPEID" />
<result property="goodsId" column="GOODS_ID" />
<result property="shelvesNum" column="SHELVES_NUM" />
<result property="remark" column="REMARK" />
<result property="version" column="VERSION" />
<result property="storageMode" column="STORAGE_MODE" />
<result property="providerId" column="PROVIDER_ID" />
<result property="productionDate" column="PRODUCTION_DATE" />
<result property="wareDate" column="WARE_DATE" />
<result property="docctnumber" column="DOCCTNUMBER" />
<result property="goodsvolume" column="GOODSVOLUME" />
<result property="occupyNum" column="OCCUPY_NUM" />
<result property="noticeId" column="NOTICE_ID" />
<result property="oriBill" column="ORI_BILL" />
<result property="ctl" column="CTL" />
<result property="barcode" column="BARCODE" />
<result property="wgh" column="WGH" />
<result property="high" column="HIGH" />
<result property="goodsName" column="GOODS_NAME" />
<result property="whseloc" column="WHSELOC" />
<result property="produclotid" column="PRODUCLOTID" />
<result property="sts" column="STS" />
<result property="customerId" column="CUSTOMER_ID" />
<result property="batchno" column="BATCHNO" />
<result property="operatorMan" column="OPERATOR_MAN" />
<result property="autosts" column="AUTOSTS" />
<result property="ableNum" column="ABLE_NUM" />
<result property="goodsMeasureId" column="GOODS_MEASURE_ID" />
<result property="period" column="PERIOD" />
<result property="dueDate" column="DUE_DATE" />
<result property="checkDate" column="CHECK_DATE" />
<result property="standard" column="STANDARD" />
<result property="flag" column="FLAG" />
<result property="netWeigh" column="NET_WEIGH" />
<result property="mark" column="MARK" />
<result property="customer" column="CUSTOMER" />
<result property="orderNum" column="ORDER_NUM" />
<result property="problem" column="PROBLEM" />
<result property="price" column="PRICE" />
<result property="packingNum" column="PACKING_NUM" />
<result property="boxType" column="BOX_TYPE" />
<result property="scaleUnit" column="SCALE_UNIT" />
<result property="locidname" column="LOCIDNAME" />
<result property="goodsSku" column="GOODS_SKU" />
<result property="expirationDate" column="EXPIRATION_DATE" />
</resultMap>
<sql id="selectTMiStockVo">
select STOCK_ID, PUTIN_ID, STORAGE_ID, AREA_ID, LOCATION_ID, GOODS_TYPEID, GOODS_ID, SHELVES_NUM, REMARK, VERSION, STORAGE_MODE, PROVIDER_ID, PRODUCTION_DATE, WARE_DATE, DOCCTNUMBER, GOODSVOLUME, OCCUPY_NUM, NOTICE_ID, ORI_BILL, CTL, BARCODE, WGH, HIGH, GOODS_NAME, WHSELOC, PRODUCLOTID, STS, CUSTOMER_ID, BATCHNO, OPERATOR_MAN, AUTOSTS, ABLE_NUM, GOODS_MEASURE_ID, PERIOD, DUE_DATE, CHECK_DATE, STANDARD, FLAG, NET_WEIGH, MARK, CUSTOMER, ORDER_NUM, PROBLEM, PRICE, PACKING_NUM, BOX_TYPE, SCALE_UNIT, LOCIDNAME, GOODS_SKU, EXPIRATION_DATE from t_mi_stock
</sql>
<select id="selectTMiStockList" parameterType="TMiStock" resultMap="TMiStockResult">
<include refid="selectTMiStockVo"/>
<where>
<if test="stockId != null and stockId != ''"> and STOCK_ID = #{stockId}</if>
<if test="putinId != null and putinId != ''"> and PUTIN_ID = #{putinId}</if>
<if test="storageId != null and storageId != ''"> and STORAGE_ID = #{storageId}</if>
<if test="areaId != null and areaId != ''"> and AREA_ID = #{areaId}</if>
<if test="locationId != null and locationId != ''"> and LOCATION_ID = #{locationId}</if>
<if test="goodsTypeid != null and goodsTypeid != ''"> and GOODS_TYPEID = #{goodsTypeid}</if>
<if test="goodsId != null and goodsId != ''"> and GOODS_ID = #{goodsId}</if>
<if test="shelvesNum != null "> and SHELVES_NUM = #{shelvesNum}</if>
<if test="remark != null and remark != ''"> and REMARK = #{remark}</if>
<if test="version != null and version != ''"> and VERSION = #{version}</if>
<if test="storageMode != null and storageMode != ''"> and STORAGE_MODE = #{storageMode}</if>
<if test="providerId != null and providerId != ''"> and PROVIDER_ID = #{providerId}</if>
<if test="productionDate != null "> and PRODUCTION_DATE = #{productionDate}</if>
<if test="wareDate != null "> and WARE_DATE = #{wareDate}</if>
<if test="docctnumber != null and docctnumber != ''"> and DOCCTNUMBER = #{docctnumber}</if>
<if test="goodsvolume != null "> and GOODSVOLUME = #{goodsvolume}</if>
<if test="occupyNum != null "> and OCCUPY_NUM = #{occupyNum}</if>
<if test="noticeId != null and noticeId != ''"> and NOTICE_ID = #{noticeId}</if>
<if test="oriBill != null and oriBill != ''"> and ORI_BILL = #{oriBill}</if>
<if test="ctl != null and ctl != ''"> and CTL = #{ctl}</if>
<if test="barcode != null and barcode != ''"> and BARCODE = #{barcode}</if>
<if test="wgh != null and wgh != ''"> and WGH = #{wgh}</if>
<if test="high != null and high != ''"> and HIGH = #{high}</if>
<if test="goodsName != null and goodsName != ''"> and GOODS_NAME like concat('%', #{goodsName}, '%')</if>
<if test="whseloc != null and whseloc != ''"> and WHSELOC = #{whseloc}</if>
<if test="produclotid != null and produclotid != ''"> and PRODUCLOTID = #{produclotid}</if>
<if test="sts != null and sts != ''"> and STS = #{sts}</if>
<if test="customerId != null and customerId != ''"> and CUSTOMER_ID = #{customerId}</if>
<if test="batchno != null and batchno != ''"> and BATCHNO = #{batchno}</if>
<if test="operatorMan != null and operatorMan != ''"> and OPERATOR_MAN = #{operatorMan}</if>
<if test="autosts != null "> and AUTOSTS = #{autosts}</if>
<if test="ableNum != null "> and ABLE_NUM = #{ableNum}</if>
<if test="goodsMeasureId != null and goodsMeasureId != ''"> and GOODS_MEASURE_ID = #{goodsMeasureId}</if>
<if test="period != null and period != ''"> and PERIOD = #{period}</if>
<if test="dueDate != null "> and DUE_DATE = #{dueDate}</if>
<if test="checkDate != null "> and CHECK_DATE = #{checkDate}</if>
<if test="standard != null and standard != ''"> and STANDARD = #{standard}</if>
<if test="flag != null and flag != ''"> and FLAG = #{flag}</if>
<if test="netWeigh != null "> and NET_WEIGH = #{netWeigh}</if>
<if test="mark != null and mark != ''"> and MARK = #{mark}</if>
<if test="customer != null and customer != ''"> and CUSTOMER = #{customer}</if>
<if test="orderNum != null and orderNum != ''"> and ORDER_NUM = #{orderNum}</if>
<if test="problem != null and problem != ''"> and PROBLEM = #{problem}</if>
<if test="price != null and price != ''"> and PRICE = #{price}</if>
<if test="packingNum != null "> and PACKING_NUM = #{packingNum}</if>
<if test="boxType != null and boxType != ''"> and BOX_TYPE = #{boxType}</if>
<if test="scaleUnit != null and scaleUnit != ''"> and SCALE_UNIT = #{scaleUnit}</if>
<if test="locidname != null and locidname != ''"> and LOCIDNAME like concat('%', #{locidname}, '%')</if>
<if test="goodsSku != null and goodsSku != ''"> and GOODS_SKU = #{goodsSku}</if>
<if test="expirationDate != null and expirationDate != ''"> and EXPIRATION_DATE = #{expirationDate}</if>
</where>
</select>
<!-- <select id="selectTMiStockOutList" parameterType="TMiStock" resultMap="TMiStockResult">-->
<!-- select distinct T1.GOODS_ID, T2.GOODS_NAME from t_mi_stock T1 LEFT JOIN t_base_goods T2 ON T1.GOODS_ID = T2.GOODS_ID-->
<!-- <where>-->
<!-- <if test="goodsId != null and goodsId != ''"> and T1.GOODS_ID like concat('%', #{goodsId}, '%')</if>-->
<!-- <if test="goodsName != null and goodsName != ''"> and T2.GOODS_NAME like concat('%', #{goodsName}, '%')</if>-->
<!-- and T1.GOODS_ID != "0000"-->
<!-- </where>-->
<!-- </select>-->
<select id="selectTMiStockOutList" parameterType="TMiStock" resultMap="TMiStockResult">
select GOODS_ID, GOODS_NAME, SUM(SHELVES_NUM) as SHELVES_NUM, WHSELOC from t_mi_stock
<where>
<if test="goodsId != null and goodsId != ''"> and GOODS_ID like concat('%', #{goodsId}, '%')</if>
<if test="produclotid != null and produclotid != ''"> and PRODUCLOTID like concat('%', #{produclotid}, '%')</if>
<if test="whseloc != null and whseloc != ''"> and WHSELOC = #{whseloc}</if>
<if test="sts != null and sts != ''"> and STS = #{sts}</if>
and GOODS_ID != "000000000"
</where>
group by GOODS_ID
</select>
<select id="selectTMiStockOutListByLot" parameterType="TMiStock" resultMap="TMiStockResult">
select GOODS_ID, PRODUCLOTID, GOODS_NAME, SUM(SHELVES_NUM) as SHELVES_NUM, WHSELOC from t_mi_stock
<where>
<if test="goodsId != null and goodsId != ''"> and GOODS_ID like concat('%', #{goodsId}, '%')</if>
<if test="produclotid != null and produclotid != ''"> and PRODUCLOTID like concat('%', #{produclotid}, '%')</if>
<if test="whseloc != null and whseloc != ''"> and WHSELOC = #{whseloc}</if>
<if test="sts != null and sts != ''"> and STS = #{sts}</if>
and GOODS_ID != "000000000"
</where>
group by PRODUCLOTID
</select>
<select id="selectTMiStockByStockId" parameterType="TMiStock" resultMap="TMiStockResult">
<include refid="selectTMiStockVo"/>
where STOCK_ID = #{stockId}
</select>
<select id="selectStock" parameterType="TMiStock" resultMap="TMiStockResult">
<include refid="selectTMiStockVo"/>
<where>
<if test="sts != null and sts != ''"> and STS = #{sts}</if>
<if test="goodsId != null and goodsId != ''"> and GOODS_ID like concat('%', #{goodsId}, '%')</if>
<if test="goodsName != null and goodsName != ''"> and GOODS_NAME like concat('%', #{goodsName}, '%')</if>
<if test="ctl != null and ctl != ''"> and CTL like concat('%', #{ctl})</if>
<if test="locationId != null and locationId != ''"> and LOCATION_ID like concat('%', #{locationId}, '%')</if>
<if test="produclotid != null and produclotid != ''"> and PRODUCLOTID like concat('%', #{produclotid}, '%')</if>
and GOODS_ID != "000000000"
</where>
</select>
<select id="selectStockEmpty" parameterType="TMiStock" resultMap="TMiStockResult">
<include refid="selectTMiStockVo"/>
<where>
<if test="ctl != null and ctl != ''"> and CTL like concat('%', #{ctl})</if>
and GOODS_ID = "000000000"
</where>
order by CTL
</select>
<select id="selectStockEkpExpireItem" parameterType="TMiStock" resultMap="TMiStockResult">
<include refid="selectTMiStockVo"/>
WHERE DATEDIFF(EXPIRATION_DATE,CURRENT_DATE) &lt;= 7 and GOODS_ID != "000000000" and (STS = "0" or STS = "2")
</select>
<select id="selectTMiStockExpired" resultMap="TMiStockResult">
<include refid="selectTMiStockVo"/>
where EXPIRATION_DATE &lt; now() and GOODS_ID != "000000000" and (STS = "0" or STS = "2")
</select>
<insert id="insertTMiStock" parameterType="TMiStock">
insert into t_mi_stock
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stockId != null">STOCK_ID,</if>
<if test="putinId != null">PUTIN_ID,</if>
<if test="storageId != null">STORAGE_ID,</if>
<if test="areaId != null">AREA_ID,</if>
<if test="locationId != null">LOCATION_ID,</if>
<if test="goodsTypeid != null">GOODS_TYPEID,</if>
<if test="goodsId != null">GOODS_ID,</if>
<if test="shelvesNum != null">SHELVES_NUM,</if>
<if test="remark != null">REMARK,</if>
<if test="version != null">VERSION,</if>
<if test="storageMode != null">STORAGE_MODE,</if>
<if test="providerId != null">PROVIDER_ID,</if>
<if test="productionDate != null">PRODUCTION_DATE,</if>
<if test="wareDate != null">WARE_DATE,</if>
<if test="docctnumber != null">DOCCTNUMBER,</if>
<if test="goodsvolume != null">GOODSVOLUME,</if>
<if test="occupyNum != null">OCCUPY_NUM,</if>
<if test="noticeId != null">NOTICE_ID,</if>
<if test="oriBill != null">ORI_BILL,</if>
<if test="ctl != null">CTL,</if>
<if test="barcode != null">BARCODE,</if>
<if test="wgh != null">WGH,</if>
<if test="high != null">HIGH,</if>
<if test="goodsName != null">GOODS_NAME,</if>
<if test="whseloc != null">WHSELOC,</if>
<if test="produclotid != null">PRODUCLOTID,</if>
<if test="sts != null">STS,</if>
<if test="customerId != null">CUSTOMER_ID,</if>
<if test="batchno != null">BATCHNO,</if>
<if test="operatorMan != null">OPERATOR_MAN,</if>
<if test="autosts != null">AUTOSTS,</if>
<if test="ableNum != null">ABLE_NUM,</if>
<if test="goodsMeasureId != null">GOODS_MEASURE_ID,</if>
<if test="period != null">PERIOD,</if>
<if test="dueDate != null">DUE_DATE,</if>
<if test="checkDate != null">CHECK_DATE,</if>
<if test="standard != null">STANDARD,</if>
<if test="flag != null">FLAG,</if>
<if test="netWeigh != null">NET_WEIGH,</if>
<if test="mark != null">MARK,</if>
<if test="customer != null">CUSTOMER,</if>
<if test="orderNum != null">ORDER_NUM,</if>
<if test="problem != null">PROBLEM,</if>
<if test="price != null">PRICE,</if>
<if test="packingNum != null">PACKING_NUM,</if>
<if test="boxType != null">BOX_TYPE,</if>
<if test="scaleUnit != null">SCALE_UNIT,</if>
<if test="locidname != null">LOCIDNAME,</if>
<if test="goodsSku != null">GOODS_SKU,</if>
<if test="expirationDate != null">EXPIRATION_DATE,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stockId != null">#{stockId},</if>
<if test="putinId != null">#{putinId},</if>
<if test="storageId != null">#{storageId},</if>
<if test="areaId != null">#{areaId},</if>
<if test="locationId != null">#{locationId},</if>
<if test="goodsTypeid != null">#{goodsTypeid},</if>
<if test="goodsId != null">#{goodsId},</if>
<if test="shelvesNum != null">#{shelvesNum},</if>
<if test="remark != null">#{remark},</if>
<if test="version != null">#{version},</if>
<if test="storageMode != null">#{storageMode},</if>
<if test="providerId != null">#{providerId},</if>
<if test="productionDate != null">#{productionDate},</if>
<if test="wareDate != null">#{wareDate},</if>
<if test="docctnumber != null">#{docctnumber},</if>
<if test="goodsvolume != null">#{goodsvolume},</if>
<if test="occupyNum != null">#{occupyNum},</if>
<if test="noticeId != null">#{noticeId},</if>
<if test="oriBill != null">#{oriBill},</if>
<if test="ctl != null">#{ctl},</if>
<if test="barcode != null">#{barcode},</if>
<if test="wgh != null">#{wgh},</if>
<if test="high != null">#{high},</if>
<if test="goodsName != null">#{goodsName},</if>
<if test="whseloc != null">#{whseloc},</if>
<if test="produclotid != null">#{produclotid},</if>
<if test="sts != null">#{sts},</if>
<if test="customerId != null">#{customerId},</if>
<if test="batchno != null">#{batchno},</if>
<if test="operatorMan != null">#{operatorMan},</if>
<if test="autosts != null">#{autosts},</if>
<if test="ableNum != null">#{ableNum},</if>
<if test="goodsMeasureId != null">#{goodsMeasureId},</if>
<if test="period != null">#{period},</if>
<if test="dueDate != null">#{dueDate},</if>
<if test="checkDate != null">#{checkDate},</if>
<if test="standard != null">#{standard},</if>
<if test="flag != null">#{flag},</if>
<if test="netWeigh != null">#{netWeigh},</if>
<if test="mark != null">#{mark},</if>
<if test="customer != null">#{customer},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="problem != null">#{problem},</if>
<if test="price != null">#{price},</if>
<if test="packingNum != null">#{packingNum},</if>
<if test="boxType != null">#{boxType},</if>
<if test="scaleUnit != null">#{scaleUnit},</if>
<if test="locidname != null">#{locidname},</if>
<if test="goodsSku != null">#{goodsSku},</if>
<if test="expirationDate != null">#{expirationDate},</if>
</trim>
</insert>
<update id="updateTMiStock" parameterType="TMiStock">
update t_mi_stock
<trim prefix="SET" suffixOverrides=",">
<if test="putinId != null">PUTIN_ID = #{putinId},</if>
<if test="storageId != null">STORAGE_ID = #{storageId},</if>
<if test="areaId != null">AREA_ID = #{areaId},</if>
<if test="locationId != null">LOCATION_ID = #{locationId},</if>
<if test="goodsTypeid != null">GOODS_TYPEID = #{goodsTypeid},</if>
<if test="goodsId != null">GOODS_ID = #{goodsId},</if>
<if test="shelvesNum != null">SHELVES_NUM = #{shelvesNum},</if>
<if test="remark != null">REMARK = #{remark},</if>
<if test="version != null">VERSION = #{version},</if>
<if test="storageMode != null">STORAGE_MODE = #{storageMode},</if>
<if test="providerId != null">PROVIDER_ID = #{providerId},</if>
<if test="productionDate != null">PRODUCTION_DATE = #{productionDate},</if>
<if test="wareDate != null">WARE_DATE = #{wareDate},</if>
<if test="docctnumber != null">DOCCTNUMBER = #{docctnumber},</if>
<if test="goodsvolume != null">GOODSVOLUME = #{goodsvolume},</if>
<if test="occupyNum != null">OCCUPY_NUM = #{occupyNum},</if>
<if test="noticeId != null">NOTICE_ID = #{noticeId},</if>
<if test="oriBill != null">ORI_BILL = #{oriBill},</if>
<if test="ctl != null">CTL = #{ctl},</if>
<if test="barcode != null">BARCODE = #{barcode},</if>
<if test="wgh != null">WGH = #{wgh},</if>
<if test="high != null">HIGH = #{high},</if>
<if test="goodsName != null">GOODS_NAME = #{goodsName},</if>
<if test="whseloc != null">WHSELOC = #{whseloc},</if>
<if test="produclotid != null">PRODUCLOTID = #{produclotid},</if>
<if test="sts != null">STS = #{sts},</if>
<if test="customerId != null">CUSTOMER_ID = #{customerId},</if>
<if test="batchno != null">BATCHNO = #{batchno},</if>
<if test="operatorMan != null">OPERATOR_MAN = #{operatorMan},</if>
<if test="autosts != null">AUTOSTS = #{autosts},</if>
<if test="ableNum != null">ABLE_NUM = #{ableNum},</if>
<if test="goodsMeasureId != null">GOODS_MEASURE_ID = #{goodsMeasureId},</if>
<if test="period != null">PERIOD = #{period},</if>
<if test="dueDate != null">DUE_DATE = #{dueDate},</if>
<if test="checkDate != null">CHECK_DATE = #{checkDate},</if>
<if test="standard != null">STANDARD = #{standard},</if>
<if test="flag != null">FLAG = #{flag},</if>
<if test="netWeigh != null">NET_WEIGH = #{netWeigh},</if>
<if test="mark != null">MARK = #{mark},</if>
<if test="customer != null">CUSTOMER = #{customer},</if>
<if test="orderNum != null">ORDER_NUM = #{orderNum},</if>
<if test="problem != null">PROBLEM = #{problem},</if>
<if test="price != null">PRICE = #{price},</if>
<if test="packingNum != null">PACKING_NUM = #{packingNum},</if>
<if test="boxType != null">BOX_TYPE = #{boxType},</if>
<if test="scaleUnit != null">SCALE_UNIT = #{scaleUnit},</if>
<if test="locidname != null">LOCIDNAME = #{locidname},</if>
<if test="goodsSku != null">GOODS_SKU = #{goodsSku},</if>
<if test="expirationDate != null">EXPIRATION_DATE = #{expirationDate},</if>
</trim>
<where>
<if test="stockId != null and stockId != ''"> and STOCK_ID = #{stockId}</if>
<if test="putinId != null and putinId != ''"> and PUTIN_ID = #{putinId}</if>
</where>
</update>
<delete id="deleteTMiStockByStockId" parameterType="String">
delete from t_mi_stock where STOCK_ID = #{stockId} and PUTIN_ID = #{putinId}
</delete>
<delete id="deleteTMiStockByStockIds" parameterType="String">
delete from t_mi_stock where STOCK_ID in
<foreach item="stockId" collection="array" open="(" separator="," close=")">
#{stockId}
</foreach>
</delete>
</mapper>