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

11 months ago
<?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-->
11 months ago
id, workPlaceCode, deptCode, invCode, productType, fifoSplit, relId, batchNo, produceDate,
11 months ago
expireDate, supId, inCount, outCount, createTime, updateTime, remark
</sql>
11 months ago
6 months ago
11 months ago
<select id="filterList" parameterType="com.glxp.api.req.inout.IoSplitFifoInvRequest" resultType="com.glxp.api.res.inout.IoSplitInvResponse">
6 months ago
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">
11 months ago
select isfi.*,
bp.cpmctymc,
bp.prepnSpec,
CASE WHEN bp.ggxh IS NULL THEN bp.bzgg ELSE bp.ggxh END AS ggxh,
11 months ago
bp.bzgg,
bu.useLevelUnit,
bp.ylqxzcrbarmc,
11 months ago
bp.nameCode,
11 months ago
bp.manufactory,
bp.measname,
bp.zczbhhzbapzbh,
bp.ybbm,
bp.zxxsdycpbs,
11 months ago
sw.workPlaceName,
swd.busName,
6 months ago
swd.monopoly,
swq.name as workPlaceQueueCodeName,
swq.enableRemind as queueEnableRemind,
swq.remindCount as queueRemindCount,
swq.maxDrugCount as maxDrugCount,
6 months ago
swf.freightRow,
(ifnull(swq.maxDrugCount,0) - ifnull(isfi.reCount,0)) as suggestOutCount
from
6 months ago
(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
11 months ago
LEFT JOIN basic_udirel bu ON bu.id = isfi.relId
6 months ago
LEFT JOIN sys_workplace_queue swq ON swq.code = isfi.workPlaceQueueCode
LEFT JOIN sys_workplace_freight swf ON swq.freightCode = swf.code
11 months ago
LEFT JOIN basic_products bp ON bu.uuid = bp.uuid
left join sys_workplace sw on sw.workplaceId = isfi.workPlaceCode
11 months ago
left join sys_workplace_document swd on swd.documentTypeCode = isfi.busType
11 months ago
<where>
<if test="relId != null">
AND isfi.relId = #{relId}
</if>
<if test="nameCode != '' and nameCode != null">
AND bp.nameCode = #{nameCode}
</if>
5 months ago
<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>
11 months ago
<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>
11 months ago
<if test="busType != null and busType != ''">
11 months ago
AND isfi.busType = #{busType}
</if>
10 months ago
<if test="cpmctymc != null and cpmctymc != ''">
AND bp.cpmctymc like concat('%', #{cpmctymc}, '%')
</if>
10 months ago
<if test="keyWords != null and keyWords != ''">
11 months ago
AND (
10 months ago
isfi.workPlaceCode like concat('%', #{keyWords}, '%')
6 months ago
or isfi.workPlaceQueueCode like concat('%', #{keyWords}, '%')
or swq.name like concat('%', #{keyWords}, '%')
10 months ago
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},'%')
11 months ago
)
11 months ago
</if>
11 months ago
<if test="remind != null and remind == 'yj' ">
6 months ago
AND swq.enableRemind = 1
6 months ago
AND (isfi.reCount - swq.remindCount) <![CDATA[ <= ]]> 0
11 months ago
</if>
11 months ago
</where>
GROUP BY isfi.workPlaceQueueCode
6 months ago
order by swf.freightRow,isfi.workPlaceQueueCode
11 months ago
</select>
</mapper>