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 #{item} 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 #{item} 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 #{item} 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 #{item} 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 #{item} 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, qjg_zt, pk_zt, dm_zt,dmjhrq,pkjhrq,qjgjhrq,ppzt ) 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, case when isnull(dm_ydjh.pkrq,'')<>'' then 'Y' else '' end , case when isnull(dm_ydjh.dmrq,'')<>'' then 'Y' else '' end , dm_bom.dmcd as dmcd, case when isnull(dm_ydjh.qjgrq,'')<>'' then 'Y' else '' end, '01', '01','01',dm_ydjh.dmrq dmjhrq,dm_ydjh.pkrq pkjhrq,dm_ydjh.qjgrq qjgjhrq,'01' 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.dc_fd=dm_bom.fd and dm_ydjh.id in #{item}