|
|
|
@ -3,7 +3,7 @@
|
|
|
|
|
<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 sum(zl) from dm_xbjh where nf=#{nf} and version=#{version} group by yf
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getEveryCompZlByNf" resultType="map">
|
|
|
|
@ -12,7 +12,9 @@
|
|
|
|
|
from
|
|
|
|
|
dm_ydjh
|
|
|
|
|
WHERE
|
|
|
|
|
jssj BETWEEN #{from} and #{to} group by MONTH(CAST(jssj AS DATE))
|
|
|
|
|
jssj BETWEEN #{from} and #{to} and lx='b' and zt>=11
|
|
|
|
|
group by
|
|
|
|
|
MONTH(CAST(jssj AS DATE))
|
|
|
|
|
order by
|
|
|
|
|
MONTH(CAST(jssj AS DATE))
|
|
|
|
|
</select>
|
|
|
|
@ -20,7 +22,7 @@
|
|
|
|
|
<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}
|
|
|
|
|
from dm_ydjh WHERE zt>=11 and jssj BETWEEN #{from} and #{to} and lx='b'
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getZjjhByUserCode" resultType="com.dsic.gj_erp.bean.jhgk.DmYdjh">
|
|
|
|
@ -30,7 +32,7 @@
|
|
|
|
|
dm_ydjh
|
|
|
|
|
WHERE
|
|
|
|
|
(slfkry =#{userCode} or pwfkry =#{userCode} or llfkry =#{userCode} or qgfkry =#{userCode} or hxfkry =#{userCode})
|
|
|
|
|
and jssj between #{from} and #{to}
|
|
|
|
|
and jssj between #{from} and #{to} and lx='b'
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getSb" resultType="java.util.Map">
|
|
|
|
@ -39,7 +41,12 @@
|
|
|
|
|
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
|
|
|
|
|
from
|
|
|
|
|
dm_ydjh
|
|
|
|
|
WHERE
|
|
|
|
|
zt>=42 and lx='b' and (hxfkrq=#{day} or qgfkrq=#{day})
|
|
|
|
|
group by
|
|
|
|
|
hxsb ,qgsb,zt
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getZyjhDetailBySbCode" resultType="com.dsic.gj_erp.bean.jhgk.DmYdjh">
|
|
|
|
@ -48,7 +55,7 @@
|
|
|
|
|
from
|
|
|
|
|
dm_ydjh
|
|
|
|
|
<where>
|
|
|
|
|
zt>=42 and (hxsb=#{code} or qgsb=#{code})
|
|
|
|
|
zt>=42 and lx='b' and (hxsb=#{code} or qgsb=#{code})
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
@ -59,7 +66,7 @@
|
|
|
|
|
from
|
|
|
|
|
dm_ydjh
|
|
|
|
|
WHERE
|
|
|
|
|
jssj BETWEEN #{from} and #{to}
|
|
|
|
|
jssj BETWEEN #{from} and #{to} and lx='b'
|
|
|
|
|
group by
|
|
|
|
|
dc_ch ,dc_pl ,qgfkrq
|
|
|
|
|
order by dc_ch ,dc_pl
|
|
|
|
@ -70,13 +77,13 @@
|
|
|
|
|
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) 四区
|
|
|
|
|
sum(case when zt>=62 and zyq1='二区' then 1 else 0 end ) OVER(PARTITION by dc_ch,dc_pl) 二区,
|
|
|
|
|
sum(case when zt>=62 and zyq1='三区' then 1 else 0 end ) OVER(PARTITION by dc_ch,dc_pl) 三区,
|
|
|
|
|
sum(case when zt>=62 and zyq1='四区' then 1 else 0 end ) OVER(PARTITION by dc_ch,dc_pl) 四区
|
|
|
|
|
from
|
|
|
|
|
dm_ydjh
|
|
|
|
|
WHERE
|
|
|
|
|
zt>=2 and jssj BETWEEN #{from} and #{to}
|
|
|
|
|
zt>=2 and jssj BETWEEN #{from} and #{to} and lx='b'
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="zyq==2">
|
|
|
|
|
and (SUBSTRING(tzbh,6,1)=1 or SUBSTRING(tzbh,6,1)=3)
|
|
|
|
@ -107,7 +114,7 @@
|
|
|
|
|
from
|
|
|
|
|
dm_ydjh
|
|
|
|
|
WHERE
|
|
|
|
|
slfkrq = #{today} or hxfkrq = #{today} or qgfkrq = #{today}
|
|
|
|
|
lx='b' and (slfkrq = #{today} or hxfkrq = #{today} or qgfkrq = #{today})
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="qfxq" resultType="java.lang.String">
|
|
|
|
@ -116,80 +123,76 @@
|
|
|
|
|
|
|
|
|
|
<select id="qfxqDetail" resultType="java.util.Map">
|
|
|
|
|
SELECT DISTINCT
|
|
|
|
|
SUM(isnull(b.bclqzl,0)/10000) over(PARTITION by dcch) zl,dcch dcCh
|
|
|
|
|
from dm_sygdxq a left join
|
|
|
|
|
(SELECT DISTINCT dcch,pl,tzbh,bclqzl from dm_bom ) b
|
|
|
|
|
on a.DC_CH =b.dcch and a.DC_PL =b.pl
|
|
|
|
|
where a.xzglxq BETWEEN #{from} and #{to} and isnull(dcch,'')!=''
|
|
|
|
|
SUM(isnull(bclqzl,0)/1000) over(PARTITION by dc_ch) as zl,dc_ch dcCh
|
|
|
|
|
from dm_sygd_mx
|
|
|
|
|
where jssj BETWEEN #{from} and #{to} and isnull(dc_ch,'')!=''
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="qfxqDetail1" resultType="java.util.Map">
|
|
|
|
|
SELECT
|
|
|
|
|
DISTINCT dc_ch dcCh,
|
|
|
|
|
sum(case when isnull(dc_pl,'')!='' then 1 else 0 end) OVER(PARTITION by dc_ch) pcsl
|
|
|
|
|
DISTINCT dc_ch dcCh,SUM(1) OVER(PARTITION by dc_ch) pcsl
|
|
|
|
|
from
|
|
|
|
|
dm_sygdxq
|
|
|
|
|
where
|
|
|
|
|
xzglxq BETWEEN #{from} and #{to}
|
|
|
|
|
(SELECT dc_ch from dm_sygd_mx where jssj BETWEEN #{from} and #{to} GROUP by dc_ch ,dc_pl) a
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="qfxqWcqk" resultType="java.util.Map">
|
|
|
|
|
SELECT * from (
|
|
|
|
|
SELECT
|
|
|
|
|
DISTINCT xq.dc_ch ,
|
|
|
|
|
sum(isnull(xq.dzjz,0)/1000) over(PARTITION by xq.dc_ch) xqzl ,
|
|
|
|
|
sum(isnull(xq.bclqzl,0)/1000) over(PARTITION by xq.dc_ch) xqzl ,
|
|
|
|
|
SUM(CONVERT( decimal, isnull(ydjh.bclqzl,'0')/1000)) over(PARTITION by xq.dc_ch) jhzl ,
|
|
|
|
|
SUM(CONVERT( decimal, case when ydjh.zt>=62 then ydjh.bclqzl else '0' end)) over(PARTITION by xq.dc_ch) wczl
|
|
|
|
|
from
|
|
|
|
|
dm_sygdxq xq left join dm_ydjh ydjh on xq.dc_ch =ydjh.dc_ch and xq.dc_pl =ydjh.dc_pl and xq.DC_FD =ydjh.DC_FD
|
|
|
|
|
dm_sygd_mx xq left join dm_ydjh ydjh on xq.dc_ch =ydjh.dc_ch and xq.dc_pl =ydjh.dc_pl and xq.tzbh =ydjh.tzbh
|
|
|
|
|
where
|
|
|
|
|
xq.xzglxq BETWEEN #{from} and #{to}
|
|
|
|
|
xq.jssj BETWEEN #{from} and #{to} and ydjh.lx='b'
|
|
|
|
|
) a where a.jhzl!=0
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="zyjh" resultType="java.util.Map">
|
|
|
|
|
SELECT
|
|
|
|
|
sum(CONVERT( decimal, isnull(bclqzl,'0'))/1000) jh,
|
|
|
|
|
count(1) zs,
|
|
|
|
|
sum(case when zt>11 then 1 else 0 end) sl
|
|
|
|
|
sum(CONVERT( decimal, isnull(bclqzl,'0'))/1000) jh,
|
|
|
|
|
count(1) zs,
|
|
|
|
|
sum(case when zt>11 then 1 else 0 end) sl
|
|
|
|
|
from
|
|
|
|
|
dm_ydjh
|
|
|
|
|
WHERE jssj BETWEEN #{from} and #{to}
|
|
|
|
|
dm_ydjh
|
|
|
|
|
WHERE
|
|
|
|
|
jssj BETWEEN #{from} and #{to} and lx='b'
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="zyjhzx" resultType="java.util.Map">
|
|
|
|
|
SELECT
|
|
|
|
|
DISTINCT zyq,day,count(1) over(PARTITION by zyq,day) sl
|
|
|
|
|
DISTINCT zyq,day,count(1) over(PARTITION by zyq,day) sl
|
|
|
|
|
from (
|
|
|
|
|
SELECT
|
|
|
|
|
'一区' as zyq,tzbh,zt,slfkrq as day
|
|
|
|
|
'一区' as zyq,tzbh,zt,DATEPART(DD,slfkrq) as day
|
|
|
|
|
from
|
|
|
|
|
dm_ydjh
|
|
|
|
|
WHERE
|
|
|
|
|
zt >=21 and jssj BETWEEN #{from} and #{to}
|
|
|
|
|
zt >=21 and jssj BETWEEN #{from} and #{to} and lx='b'
|
|
|
|
|
UNION ALL
|
|
|
|
|
SELECT
|
|
|
|
|
'二区' as zyq,tzbh,zt,qgfkrq as day
|
|
|
|
|
'二区' as zyq,tzbh,zt,DATEPART(DD,qgfkrq) as day
|
|
|
|
|
from
|
|
|
|
|
dm_ydjh
|
|
|
|
|
WHERE
|
|
|
|
|
zt >=62 and jssj BETWEEN #{from} and #{to} and (SUBSTRING(tzbh,6,1)='1' or
|
|
|
|
|
SUBSTRING(tzbh,6,1)='3')
|
|
|
|
|
zt >=62 and jssj BETWEEN #{from} and #{to} and zyq1='二区' and lx='b'
|
|
|
|
|
UNION ALL
|
|
|
|
|
SELECT
|
|
|
|
|
'三区',tzbh,zt,qgfkrq as day
|
|
|
|
|
'三区',tzbh,zt,DATEPART(DD,qgfkrq) as day
|
|
|
|
|
from
|
|
|
|
|
dm_ydjh
|
|
|
|
|
WHERE
|
|
|
|
|
zt >=62 and jssj BETWEEN #{from} and #{to} and SUBSTRING(tzbh,6,1)='2'
|
|
|
|
|
zt >=62 and jssj BETWEEN #{from} and #{to} and zyq1='三区' and lx='b'
|
|
|
|
|
UNION ALL
|
|
|
|
|
SELECT
|
|
|
|
|
'四区',tzbh,zt,qgfkrq as day
|
|
|
|
|
'四区',tzbh,zt,DATEPART(DD,qgfkrq) as day
|
|
|
|
|
from
|
|
|
|
|
dm_ydjh
|
|
|
|
|
WHERE
|
|
|
|
|
zt >=62 and jssj BETWEEN #{from} and #{to} and SUBSTRING(tzbh,6,1)='4'
|
|
|
|
|
zt >=62 and jssj BETWEEN #{from} and #{to} and zyq1='四区' and lx='b'
|
|
|
|
|
) a
|
|
|
|
|
where isnull(a.day,'')!=''
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="todayZyjhzx" resultType="java.util.Map">
|
|
|
|
@ -200,7 +203,7 @@
|
|
|
|
|
from
|
|
|
|
|
dm_ydjh
|
|
|
|
|
WHERE
|
|
|
|
|
jssj BETWEEN #{from} and #{to}
|
|
|
|
|
jssj BETWEEN #{from} and #{to} and lx='b'
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="xbgtt" resultType="java.util.Map">
|
|
|
|
@ -208,7 +211,7 @@
|
|
|
|
|
DISTINCT a.dc_ch dcCh,a.yf,sum(a.zl/1000) over(PARTITION by a.dc_ch,a.yf) zl ,
|
|
|
|
|
sum(CONVERT(decimal,b.bclqzl)/1000) over(PARTITION by b.dc_ch,MONTH(CAST(b.jssj AS DATE))) jhzl
|
|
|
|
|
from dm_xbjh a left join dm_ydjh b on a.dc_ch =b.dc_ch and
|
|
|
|
|
CONVERT(int,a.yf)=MONTH(CAST(b.jssj AS DATE)) WHERE a.nf=#{nf}
|
|
|
|
|
CONVERT(int,a.yf)=MONTH(CAST(b.jssj AS DATE)) WHERE a.nf=#{nf} and a.version=#{version}
|
|
|
|
|
order by a.dc_ch, a.yf
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
@ -241,11 +244,9 @@
|
|
|
|
|
|
|
|
|
|
<select id="xqzl" resultType="BigDecimal">
|
|
|
|
|
SELECT
|
|
|
|
|
SUM(isnull(b.bclqzl,0)/10000)
|
|
|
|
|
from dm_sygdxq a left join
|
|
|
|
|
(SELECT DISTINCT dcch,pl,tzbh,bclqzl from dm_bom ) b
|
|
|
|
|
on a.DC_CH =b.dcch and a.DC_PL =b.pl
|
|
|
|
|
where a.xzglxq BETWEEN #{from} and #{to}
|
|
|
|
|
SUM(isnull(bclqzl,0)/1000)
|
|
|
|
|
from dm_sygd_mx
|
|
|
|
|
where jssj BETWEEN #{from} and #{to}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="dhzl" resultType="BigDecimal">
|
|
|
|
@ -254,11 +255,15 @@
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="jhzl" resultType="BigDecimal">
|
|
|
|
|
SELECT SUM(isnull(bclqzl,0)/1000) FROM dm_ydjh WHERE jssj BETWEEN #{from} and #{to}
|
|
|
|
|
SELECT SUM(isnull(bclqzl,0)/1000) FROM dm_ydjh WHERE jssj BETWEEN #{from} and #{to} and lx='b'
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="wczl" resultType="BigDecimal">
|
|
|
|
|
SELECT SUM(case when zt>=62 then isnull(bclqzl,0)/1000 else 0 end) FROM dm_ydjh WHERE jssj
|
|
|
|
|
BETWEEN #{from} and #{to}
|
|
|
|
|
SELECT
|
|
|
|
|
SUM(case when zt>=62 then isnull(bclqzl,0)/1000 else 0 end)
|
|
|
|
|
FROM
|
|
|
|
|
dm_ydjh
|
|
|
|
|
WHERE
|
|
|
|
|
jssj BETWEEN #{from} and #{to} and lx='b'
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|
|
|
|
|