@ -144,15 +144,15 @@
dm_sygd_mx.bcqpyld,
dm_sygd_mx.ylbhgg,t.xqsj as jssj from
( SELECT DC_CH,DC_PL,DC_FD,tzbh,xqsj,rn FROM
( SELECT dm_qfxq.db as xqsj,dm_bom.tzbh,
( SELECT dm_qfxq.xzglxq as xqsj,dm_bom.tzbh,
dm_qfxq.DC_CH,dm_qfxq.DC_PL,dm_qfxq.DC_FD,
row_number() over(partition by dm_qfxq.DC_CH,dm_qfxq.DC_PL,dm_bom.tzbh order by dm_qfxq.db ) rn
row_number() over(partition by dm_qfxq.DC_CH,dm_qfxq.DC_PL,dm_bom.tzbh order by dm_qfxq.xzglxq ) rn
from dm_qfxq LEFT JOIN dm_bom
on dm_bom.dcch = dm_qfxq.DC_CH
and dm_bom.pl = dm_qfxq.DC_PL
and dm_bom.fd = dm_qfxq.DC_FD
where
substring(dm_qfxq.db , 0, 8) =#{nextMonth}) r where r.rn=1
substring(dm_qfxq.xzglxq , 0, 8) =#{nextMonth}) r where r.rn=1
)t LEFT JOIN dm_sygd_mx
on dm_sygd_mx.dc_ch=t.DC_CH and dm_sygd_mx.dc_pl=t.DC_PL and dm_sygd_mx.tzbh=t.TZBH
order BY t.xqsj,t.DC_CH,t.DC_PL
@ -181,26 +181,33 @@
dm_czplp_new.jsq_lqb as lqbjsrq,
dm_czplp_new.xfq_tlt as tltxfrq,
dm_czplp_new.jsq_tlt as tltjsrq,
dm_ydjh.qgrq as qgxqrq,
dm_ydjh.jssj as qfxqrqxz,
dm_ydjh.gjjs_dz as qfxqrqdz,
MIN( dm_ydjh.qgrq) as qgxqrq,
MIN( dm_ydjh.jssj) as qfxqrqxz,
MIN( dm_ydjh.gjjs_dz) as qfxqrqdz,
REPLACE(CAST(CAST(NEWID()AS BINARY(10)) + CAST(GETDATE() AS BINARY(6)) AS UNIQUEIDENTIFIER),'-','')
as id
from dm_ydjh LEFT JOIN
(SELECT dm_czplp_new.DC_CH,dm_czplp_new.DC_PL,dm_czplp_new.jsq_lqb,dm_czplp_new.jsq_tlt,dm_czplp_new.xfq_lqb,dm_czplp_new.xfq_tlt,dm_czplp_new.jsq_ptb,dm_czplp_new.xfq_ptb
from dm_czplp_new
GROUP BY dm_czplp_new.DC_CH,dm_czplp_new.DC_PL,dm_czplp_new.jsq_lqb,dm_czplp_new.jsq_tlt,dm_czplp_new.xfq_lqb,dm_czplp_new.xfq_tlt,dm_czplp_new.jsq_ptb,dm_czplp_new.xfq_ptb)
dm_czplp_new
from
dm_ydjh
LEFT JOIN dm_czplp_new
on
dm_ydjh.dc_ch=dm_czplp_new.DC_CH and
dm_ydjh.dc_pl=dm_czplp_new.DC_pl
WHERE
dm_ydjh.qgrq BETWEEN #{begin} and #{end}
GROUP BY
dm_ydjh.dc_ch,
dm_ydjh.dc_pl,
dm_ydjh.dc_fd,
dm_czplp_new.xfq_lqb,
dm_czplp_new.jsq_lqb,
dm_czplp_new.xfq_tlt,
dm_czplp_new.jsq_tlt
</select>
<select id= "getDhjh" resultType= "com.dsic.gj_erp.bean.pgd.PgdDh" >
insert into pgd_dh
(id,
czbh,
pl,
dhqdh,
wpcz,
slxqrq,
@ -216,7 +223,7 @@
SELECT
REPLACE(CAST(CAST(NEWID()AS BINARY(10)) + CAST(GETDATE() AS BINARY(6)) AS UNIQUEIDENTIFIER),'-','') as id,
dm_ydjh.dc_ch as czbh,
dm_czplp_new .dhqd as dhqdh,
dm_ydjh .dhqd as dhqdh,
dm_ydjh.jssj as qfxqrqxz,
dm_ydjh.gjjs_dz as qfxqrqdz,
dm_ydjh.slrq as slxqrq,
@ -230,13 +237,6 @@
dhxx.RKXH as wpcz
from dm_ydjh
LEFT JOIN
(SELECT DC_CH, DC_PL, dhqd
from dm_czplp_new
GROUP BY DC_CH, DC_PL, dhqd) dm_czplp_new
on
dm_ydjh.dc_ch = dm_czplp_new.DC_CH and
dm_ydjh.dc_pl = dm_czplp_new.DC_pl
LEFT JOIN
(select MS_DDJBP.CGFLM,
MS_DDJBP.DDH,
MS_DDJBP.ddmc as ddmc,
@ -261,7 +261,7 @@
and im_crklsz.HDLX <![CDATA[ <> ]]> '99'
GROUP BY MS_DDJBP.CGFLM, MS_DDJBP.DDH, MS_DDJBP.ddmc, MS_DDMXP.dc_ch, MS_DDMXP.WPHD, MS_DDMXP.WPCD,
MS_DDMXP.WPKD, MS_DDMXP.RKXH, MS_DDJBP.dhqdh) dhxx
on dhxx.dhqdh = dm_czplp_new .dhqd
on dhxx.dhqdh = dm_ydjh .dhqd
where dm_ydjh.slrq BETWEEN #{begin} and #{end}
ORDER BY dm_ydjh.dc_ch,
dm_ydjh.dc_pl
@ -311,6 +311,7 @@
dm_ydjh.dc_pl=IM_CKWPKWP.DC_pl and
dm_ydjh.tzbh=IM_CKWPKWP.DC_th
WHERE dm_ydjh.slrq BETWEEN #{begin} and #{end}
</select>
<select id= "getPwjh" resultType= "com.dsic.gj_erp.bean.pgd.PgdPwjh" >
@ -397,4 +398,114 @@
from dm_ydjh
where dm_ydjh.qgrq BETWEEN #{begin} and #{end}
</select>
<update id= "xfbc" parameterType= "arraylist" >
update pgd_tzjh
set zt='01'
from pgd_tzjh,dm_ydjh
where pgd_tzjh.czbh= dm_ydjh.dc_ch and pgd_tzjh.pl=dm_ydjh.dc_pl
and dm_ydjh.id in
<foreach collection= "ids" index= "index" item= "item" open= "(" separator= "," close= ");" >
#{item}
</foreach>
update pgd_dh
set zt='01'
from pgd_dh,dm_ydjh
where pgd_dh.czbh= dm_ydjh.dc_ch and pgd_dh.dhqdh=dm_ydjh.dhqdh
and dm_ydjh.id in
<foreach collection= "ids" index= "index" item= "item" open= "(" separator= "," close= ");" >
#{item}
</foreach>
update pgd_sljh
set zt='01'
from pgd_sljh,dm_ydjh
where pgd_sljh.czbh= dm_ydjh.dc_ch and pgd_sljh.pl=dm_ydjh.dc_pl and pgd_sljh.tlth=dm_ydjh.tzbh
and dm_ydjh.id in
<foreach collection= "ids" index= "index" item= "item" open= "(" separator= "," close= ");" >
#{item}
</foreach>
update pgd_pwjh
set zt='01'
from pgd_pwjh,dm_ydjh
where pgd_pwjh.czbh= dm_ydjh.dc_ch and pgd_pwjh.pl=dm_ydjh.dc_pl and pgd_pwjh.tlth=dm_ydjh.tzbh
and dm_ydjh.id in
<foreach collection= "ids" index= "index" item= "item" open= "(" separator= "," close= ");" >
#{item}
</foreach>
update pgd_qgjh
set zt='01'
from pgd_qgjh,dm_ydjh
where pgd_qgjh.czbh= dm_ydjh.dc_ch and pgd_qgjh.pl=dm_ydjh.dc_pl and pgd_qgjh.tlth=dm_ydjh.tzbh
and dm_ydjh.id in
<foreach collection= "ids" index= "index" item= "item" open= "(" separator= "," close= ");" >
#{item}
</foreach>
</update>
<insert id= "tqlj" parameterType= "arraylist" >
insert into dm_ydjh_lj (
id,
czbh,
pl,
fd,
kw,
zl,
tlth,
ptblx,
ljbh,
ljmc,
ljgg,
ljcz,
wpfl,
jldw,
sl,
qfxqrqxz,
qfxqrqdz,
gylx,
pklx,
pkcd,
pkbs,
dmbs,
dmcd,
qbs
)
SELECT
REPLACE(CAST(CAST(NEWID()AS BINARY(10)) + CAST(GETDATE() AS BINARY(6)) AS UNIQUEIDENTIFIER),'-','') as id,
dm_ydjh.dc_ch as czbh,
dm_ydjh.dc_pl as pl,
dm_bom.fd as fd,
dm_ydjh.kw as kw,
dm_bom.zl as zl,
dm_bom.tzbh as tlth,
'' as ptblx,
dm_bom.ljbh as ljbh,
'' as ljmc,
dm_bom.wpgg as ljgg,
dm_bom.wpcz as ljcz,
'' as wpfl,
'' as jldw,
dm_bom.ljsl as sl,
dm_qfxq.xzglxq as qfxqrqxz,
dm_qfxq.dzglxq as qfxqrqdz,
'' as gylx,
dm_bom.pklx as pklx,
dm_bom.pkcd as pkcd,
dm_bom.pkbs as pkbs,
dm_bom.dmbs as dmbs,
dm_bom.dmcd as dmcd,
dm_bom.qbs as qbs
from dm_ydjh,dm_bom
LEFT JOIN dm_qfxq on dm_qfxq.DC_CH=dm_bom.dcch and dm_qfxq.DC_PL=dm_bom.pl and dm_qfxq.DC_FD=dm_bom.fd
WHERE
dm_ydjh.dc_ch= dm_bom.dcch
and dm_ydjh.dc_pl=dm_bom.pl
and dm_ydjh.tzbh=dm_bom.tzbh
and dm_ydjh.id in
<foreach collection= "ids" index= "index" item= "item" open= "(" separator= "," close= ");" >
#{item}
</foreach>
</insert>
</mapper>