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.
udi-wms-java/src/main/resources/mybatis/mapper/inout/IoSplitFifoInvMapper.xml

218 lines
9.7 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.glxp.api.dao.inout.IoSplitFifoInvMapper">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.inout.IoSplitFifoInv">
<!--@mbg.generated-->
<!--@Table io_split_fifo_inv-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="workPlaceCode" jdbcType="VARCHAR" property="workPlaceCode" />
<result column="deptCode" jdbcType="VARCHAR" property="deptCode" />
<result column="invCode" jdbcType="VARCHAR" property="invCode" />
<result column="productType" jdbcType="VARCHAR" property="productType" />
<result column="fifoSplit" jdbcType="VARCHAR" property="fifoSplit" />
<result column="relId" jdbcType="INTEGER" property="relId" />
<result column="batchNo" jdbcType="INTEGER" property="batchNo" />
<result column="produceDate" jdbcType="TIMESTAMP" property="produceDate" />
<result column="expireDate" jdbcType="TIMESTAMP" property="expireDate" />
<result column="supId" jdbcType="INTEGER" property="supId" />
<result column="inCount" jdbcType="VARCHAR" property="inCount" />
<result column="outCount" jdbcType="VARCHAR" property="outCount" />
<result column="createTime" jdbcType="TIMESTAMP" property="createTime" />
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, workPlaceCode, deptCode, invCode, productType, fifoSplit, relId, batchNo, produceDate,
expireDate, supId, inCount, outCount, createTime, updateTime, remark
</sql>
<select id="filterList" parameterType="com.glxp.api.req.inout.IoSplitFifoInvRequest" resultType="com.glxp.api.res.inout.IoSplitInvResponse">
select isfi.*,
bp.cpmctymc,
bp.ggxh,
bp.bzgg,
bu.useLevelUnit,
bp.ylqxzcrbarmc,
bp.nameCode,
bp.manufactory,
bp.measname,
bp.zczbhhzbapzbh,
bp.ybbm,
bp.zxxsdycpbs,
bc.name supName,
sw.workPlaceName,
swd.busName,
swd.monopoly
from io_split_fifo_inv isfi
LEFT JOIN basic_udirel bu ON bu.id = isfi.relId
LEFT JOIN basic_products bp ON bu.uuid = bp.uuid
left join basic_corp bc on bc.erpId = isfi.supId
left join sys_workplace sw on sw.workplaceId = isfi.workPlaceCode
left join sys_workplace_document swd on swd.documentTypeCode = isfi.busType
<where>
<if test="relId != null">
AND isfi.relId = #{relId}
</if>
<if test="nameCode != '' and nameCode != null">
AND bp.nameCode = #{nameCode}
</if>
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
AND bp.zczbhhzbapzbh like concat('%', #{zczbhhzbapzbh}, '%')
</if>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
AND (
bp.ylqxzcrbarmc like concat('%', #{ylqxzcrbarmc}, '%')
or bp.manufactory like concat('%', #{ylqxzcrbarmc}, '%'))
</if>
<if test="batchNo != '' and batchNo != null">
AND isfi.batchNo = #{batchNo}
</if>
<if test="invCode != null">
AND isfi.invCode = #{invCode}
</if>
<if test="supId != null">
AND isfi.supId = #{supId}
</if>
<if test="fifoSplit != null">
AND isfi.fifoSplit = #{fifoSplit}
</if>
<if test="productType != null">
AND isfi.productType = #{productType}
</if>
<if test="workPlaceCode != null">
AND isfi.workPlaceCode = #{workPlaceCode}
</if>
<if test="busType != null and busType != ''">
AND isfi.busType = #{busType}
</if>
<if test="cpmctymc != null and cpmctymc != ''">
AND bp.cpmctymc like concat('%', #{cpmctymc}, '%')
</if>
<if test="keyWords != null and keyWords != ''">
AND (
isfi.workPlaceCode like concat('%', #{keyWords}, '%')
or bp.nameCode like concat('%', #{keyWords}, '%')
or isfi.batchNo like concat('%', #{keyWords}, '%')
or bp.cpmctymc like concat('%', #{keyWords}, '%')
or bp.ggxh like concat('%', #{keyWords}, '%')
or bp.bzgg like concat('%', #{keyWords}, '%')
or bp.nameCode like concat('%', #{keyWords}, '%')
or bp.zczbhhzbapzbh like concat('%', #{keyWords}, '%')
or bp.ylqxzcrbarmc like concat('%', #{keyWords}, '%')
or bp.manufactory like concat('%',#{keyWords},'%')
or bc.name like concat('%',#{keyWords},'%')
or swd.busName like concat('%',#{keyWords},'%')
)
</if>
<if test="remind != null and remind == 'yj' ">
AND not exists(select 1 from io_split_fifo_inv t where t.enableRemind = 0 and (t.reCount - t.invRemindCount) <![CDATA[ >= ]]> 0 and t.id = isfi.id )
</if>
</where>
GROUP BY id
</select>
<select id="filterKcyjList" parameterType="com.glxp.api.req.inout.IoSplitFifoInvRequest" resultType="com.glxp.api.res.inout.IoSplitInvResponse">
select isfi.*,
bp.cpmctymc,
bp.prepnSpec,
CASE WHEN bp.ggxh IS NULL THEN bp.bzgg ELSE bp.ggxh END AS ggxh,
bp.bzgg,
bu.useLevelUnit,
bp.ylqxzcrbarmc,
bp.nameCode,
bp.manufactory,
bp.measname,
bp.zczbhhzbapzbh,
bp.ybbm,
bp.zxxsdycpbs,
sw.workPlaceName,
swd.busName,
swd.monopoly,
swq.name as workPlaceQueueCodeName,
swq.enableRemind as queueEnableRemind,
swq.remindCount as queueRemindCount,
swq.maxDrugCount as maxDrugCount,
swf.freightRow,
(ifnull(swq.maxDrugCount,0) - ifnull(isfi.reCount,0)) as suggestOutCount
from
(select relId,sum(reCodeCount) as reCount,sum(availableCount) as availableCount,supId,workPlaceQueueCode,workPlaceCode,busType from io_split_fifo_inv
group by relId,supId,workPlaceQueueCode,workPlaceCode,busType
) as isfi
LEFT JOIN basic_udirel bu ON bu.id = isfi.relId
LEFT JOIN sys_workplace_queue swq ON swq.code = isfi.workPlaceQueueCode
LEFT JOIN sys_workplace_freight swf ON swq.freightCode = swf.code
LEFT JOIN basic_products bp ON bu.uuid = bp.uuid
left join sys_workplace sw on sw.workplaceId = isfi.workPlaceCode
left join sys_workplace_document swd on swd.documentTypeCode = isfi.busType
<where>
<if test="relId != null">
AND isfi.relId = #{relId}
</if>
<if test="nameCode != '' and nameCode != null">
AND bp.nameCode = #{nameCode}
</if>
<if test="freightRow != '' and freightRow != null">
AND swf.freightRow like concat('%', #{freightRow}, '%')
</if>
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
AND bp.zczbhhzbapzbh like concat('%', #{zczbhhzbapzbh}, '%')
</if>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
AND (
bp.ylqxzcrbarmc like concat('%', #{ylqxzcrbarmc}, '%')
or bp.manufactory like concat('%', #{ylqxzcrbarmc}, '%'))
</if>
<if test="batchNo != '' and batchNo != null">
AND isfi.batchNo = #{batchNo}
</if>
<if test="invCode != null">
AND isfi.invCode = #{invCode}
</if>
<if test="supId != null">
AND isfi.supId = #{supId}
</if>
<if test="fifoSplit != null">
AND isfi.fifoSplit = #{fifoSplit}
</if>
<if test="productType != null">
AND isfi.productType = #{productType}
</if>
<if test="workPlaceCode != null">
AND isfi.workPlaceCode = #{workPlaceCode}
</if>
<if test="busType != null and busType != ''">
AND isfi.busType = #{busType}
</if>
<if test="cpmctymc != null and cpmctymc != ''">
AND bp.cpmctymc like concat('%', #{cpmctymc}, '%')
</if>
<if test="keyWords != null and keyWords != ''">
AND (
isfi.workPlaceCode like concat('%', #{keyWords}, '%')
or isfi.workPlaceQueueCode like concat('%', #{keyWords}, '%')
or swq.name like concat('%', #{keyWords}, '%')
or bp.nameCode like concat('%', #{keyWords}, '%')
or isfi.batchNo like concat('%', #{keyWords}, '%')
or bp.cpmctymc like concat('%', #{keyWords}, '%')
or bp.ggxh like concat('%', #{keyWords}, '%')
or bp.bzgg like concat('%', #{keyWords}, '%')
or bp.nameCode like concat('%', #{keyWords}, '%')
or bp.zczbhhzbapzbh like concat('%', #{keyWords}, '%')
or bp.ylqxzcrbarmc like concat('%', #{keyWords}, '%')
or bp.manufactory like concat('%',#{keyWords},'%')
or swd.busName like concat('%',#{keyWords},'%')
)
</if>
<if test="remind != null and remind == 'yj' ">
AND swq.enableRemind = 1
AND (isfi.reCount - swq.remindCount) <![CDATA[ <= ]]> 0
</if>
</where>
GROUP BY isfi.workPlaceQueueCode
order by swf.freightRow,isfi.workPlaceQueueCode
</select>
</mapper>