|
|
|
<?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.dsic.gj_erp.mapper.KbanMapper">
|
|
|
|
|
|
|
|
<select id="getEveryMonXbzlByNf" resultType="double">
|
|
|
|
select sum(zl) from dm_xbjh where nf=#{nf} group by yf
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getEveryCompZlByNf" resultType="map">
|
|
|
|
SELECT MONTH(CAST(qgfkrq AS DATE)) mon,sum(bcshzl)/1000 zl from dm_ydjh WHERE qgfkrq BETWEEN #{from} and #{to} group by MONTH(CAST(qgfkrq AS DATE))
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getEveryKw" resultType="java.util.Map">
|
|
|
|
SELECT
|
|
|
|
zt,SUBSTRING(tzbh,6,1) kw
|
|
|
|
from dm_ydjh WHERE zt>=11 and jssj BETWEEN #{from} and #{to}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getZjjhByUserCode" resultType="com.dsic.gj_erp.bean.jhgk.DmYdjh">
|
|
|
|
SELECT
|
|
|
|
*
|
|
|
|
from
|
|
|
|
dm_ydjh
|
|
|
|
WHERE
|
|
|
|
(slfkry =#{userCode} or pwfkry =#{userCode} or llfkry =#{userCode} or qgfkry =#{userCode} or hxfkry =#{userCode})
|
|
|
|
and jssj between #{from} and #{to}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getSb" resultType="java.util.Map">
|
|
|
|
SELECT
|
|
|
|
hxsb ,qgsb,
|
|
|
|
case when zt>=42 then sum(1) end p,
|
|
|
|
case when zt>=52 then sum(1) end hx,
|
|
|
|
case when zt>=62 then sum(1) end qg
|
|
|
|
from dm_ydjh WHERE zt>=42 and (hxfkrq=#{day} or qgfkrq=#{day}) group by hxsb ,qgsb,zt
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getZyjhDetailBySbCode" resultType="com.dsic.gj_erp.bean.jhgk.DmYdjh">
|
|
|
|
select
|
|
|
|
*
|
|
|
|
from
|
|
|
|
dm_ydjh
|
|
|
|
<where>
|
|
|
|
zt>=42 and (hxsb=#{code} or qgsb=#{code})
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getJhgz" resultType="java.util.Map">
|
|
|
|
SELECT
|
|
|
|
DISTINCT dc_ch ,dc_pl ,min(sljhrq) b ,sum(1) sl,case when isnull(qgfkrq,'')!='' then sum(1) end wcsl,
|
|
|
|
case when isnull(qgfkrq ,'')!='' then max(qgfkrq) else CONVERT(varchar,dateadd(day,14,min(sljhrq)),111) end e
|
|
|
|
from
|
|
|
|
dm_ydjh
|
|
|
|
WHERE
|
|
|
|
jssj BETWEEN #{from} and #{to}
|
|
|
|
group by
|
|
|
|
dc_ch ,dc_pl ,qgfkrq
|
|
|
|
order by dc_ch ,dc_pl
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getZyjhtj" resultType="java.util.Map">
|
|
|
|
SELECT
|
|
|
|
DISTINCT dc_ch ,dc_pl ,
|
|
|
|
sum(case when zt>=2 then 1 else 0 end ) OVER(PARTITION by dc_ch,dc_pl) jhsl,
|
|
|
|
sum(case when zt>11 then 1 else 0 end ) OVER(PARTITION by dc_ch,dc_pl) 一区,
|
|
|
|
sum(case when zt>=62 and (SUBSTRING(tzbh,6,1)=1 or SUBSTRING(tzbh,6,1)=3) then 1 else 0 end ) OVER(PARTITION by dc_ch,dc_pl) 二区,
|
|
|
|
sum(case when zt>=62 and SUBSTRING(tzbh,6,1)=2 then 1 else 0 end ) OVER(PARTITION by dc_ch,dc_pl) 三区,
|
|
|
|
sum(case when zt>=62 and SUBSTRING(tzbh,6,1)=4 then 1 else 0 end ) OVER(PARTITION by dc_ch,dc_pl) 四区
|
|
|
|
from
|
|
|
|
dm_ydjh
|
|
|
|
WHERE
|
|
|
|
zt>=2 and jssj BETWEEN #{form} and #{to}
|
|
|
|
<choose>
|
|
|
|
<when test="zyq!=null and zyq!='' and zyq='2'">
|
|
|
|
and (SUBSTRING(tzbh,6,1)=1 or SUBSTRING(tzbh,6,1)=3)
|
|
|
|
</when>
|
|
|
|
<when test="zyq=null or zyq=''">
|
|
|
|
|
|
|
|
</when>
|
|
|
|
<otherwise>
|
|
|
|
and (SUBSTRING(tzbh,6,1)=#{zyq}
|
|
|
|
</otherwise>
|
|
|
|
</choose>
|
|
|
|
order by dc_ch ,dc_pl
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="zxqZxDetail" resultType="java.util.Map">
|
|
|
|
SELECT
|
|
|
|
dc_ch dcCh,
|
|
|
|
dc_pl dcPl,
|
|
|
|
dc_fd dcFd,
|
|
|
|
tzbh,
|
|
|
|
case when zt='21' then '上料' when zt='32' then '抛丸' when zt='42' then '理料' when zt='52' then '划线' when zt='62' then '切割' end gx,
|
|
|
|
case when zt='21' then slfkrq when zt='32' then pwfkrq when zt='42' then llfkrq when zt='52' then hxfkrq when zt='62' then qgfkrq end compAt,
|
|
|
|
case when substring(tzbh,6,1)=1 or substring(tzbh,6,1)=3 then '二区' when substring(tzbh,6,1)=2 then '三区' when substring(tzbh,6,1)=4 then '四区' end zyq ,
|
|
|
|
case when zt='21' then slfkry when zt='32' then pwfkry when zt='42' then llfkry when zt='52' then hxfkry when zt='62' then qgfkry end name
|
|
|
|
from
|
|
|
|
dm_ydjh
|
|
|
|
WHERE
|
|
|
|
slfkrq = #{today} or hxfkrq = #{today} or qgfkrq = #{today}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getZxqwcqk" resultType="java.util.Map">
|
|
|
|
|
|
|
|
</select>
|
|
|
|
</mapper>
|