`SELECT * FROM (SELECT pmdmsix ,wzpm ,sum(case when lx ='LS' then hwsl else 0 end) SY ,sum(case when lx ='LW' then hwsl else 0 end) YL,sum(hwsl) ZS from (SELECT hx.pmdmsix, hx.wzpm,sum(hw.hwsl) hwsl,(case when hwh ='LS-1-1-1' then 'LS' else 'LW' end ) LX FROM tab_bzgl_knzy_app_hwb hw INNER JOIN TAB_BZGL_KNZY_APP_HJB hj ON hj.guid = hw.hjguid INNER JOIN TAB_BZGL_KNZY_APP_QYB qy ON qy.guid = hj.qyguid LEFT JOIN tab_xtwh_jcsj_bzhx hx ON hw.pmdmcode = hx.pmdmten WHERE hw.pmdmcode IS NOT NULL AND hw.hwsl IS NOT NULL AND hw.gldwguid = ${params.gldwguid} AND hw.kfguid = ${params.kfguid} AND hw.zmlx = ${params.zmlx}`
const sql2 = ` AND (hx.wzpm like ${params.wzpm})`
...
...
@@ -583,23 +584,24 @@ WHERE
return sql1 + sql3
}
}
static getHXpageSql(params?: any):string{
const sql=`select hw.pmdmcode, hx.hxmc, sum (case when hw.hwh='LS-1-1-1' then ifnull (hw.hwsl,0) +0 else 0 end) SY,sum (case when hw.hwh != 'LS-1-1-1' then ifnull (hw.hwsl, 0) +0 else 0 end) YL from tab_bzgl_knzy_app_hwb hw inner join TAB_BZGL_KNZY_APP_HJB hj on hj.guid = hw.hjguid inner join TAB_BZGL_KNZY_APP_QYB gy on gy.guid = hj.qyguid left join TAB_XTWH_JCSJ_BZHX hx on hw.pmdmcode = hx.pmdmten where substr (hw.pmdmcode, 1, 6) = ${params.pmdmcode} and hw.kfguid = ${params.kfguid} and hw.gldwguid= ${params.gldwguid} and zmlx = ${params.zmlx} group by hw.pmdmcode, hx.hxmc`
static getHXpageSql(params?: any): string {
const sql = `select hw.pmdmcode, hx.hxmc, sum (case when hw.hwh='LS-1-1-1' then ifnull (hw.hwsl,0) +0 else 0 end) SY,sum (case when hw.hwh != 'LS-1-1-1' then ifnull (hw.hwsl, 0) +0 else 0 end) YL from tab_bzgl_knzy_app_hwb hw inner join TAB_BZGL_KNZY_APP_HJB hj on hj.guid = hw.hjguid inner join TAB_BZGL_KNZY_APP_QYB gy on gy.guid = hj.qyguid left join TAB_XTWH_JCSJ_BZHX hx on hw.pmdmcode = hx.pmdmten where substr (hw.pmdmcode, 1, 6) = ${params.pmdmcode} and hw.kfguid = ${params.kfguid} and hw.gldwguid= ${params.gldwguid} and zmlx = ${params.zmlx} group by hw.pmdmcode, hx.hxmc`
return sql
}
/*验证扫描:验证扫描完的数据有没有*/
static testInsertSql(params?: any):string{
const sql= `select * from (select hw.*,qy.kfdm kfdm from tab_bzgl_knzy_app_hwb hw left join tab_bzgl_knzy_app_hjb hj on hj.guid = hw.hjguid left join tab_bzgl_knzy_app_qyb qy on qy.guid = hj.qyguid ) where kfguid = '${params.kfguid}' and hwh = ${params.hwh} and (pmdmcode = ${(params.pmdmcode)} or pmdmcode ='' or pmdmcode is null )`
static testInsertSql(params?: any): string {
const sql= `select * from (select hw.*,qy.kfdm kfdm from tab_bzgl_knzy_app_hwb hw left join tab_bzgl_knzy_app_hjb hj on hj.guid = hw.hjguid left join tab_bzgl_knzy_app_qyb qy on qy.guid = hj.qyguid ) where kfguid = '${params.kfguid}' and hwh = ${params.hwh} and (pmdmcode = ${(params.pmdmcode)} or pmdmcode ='' or pmdmcode is null )`
return sql
}
/*验证扫描完更新*/
static updateWzcshSql(params?: any):string{
const sql=`update tab_bzgl_knzy_app_hwb set hwsl = ifnull(hwsl,0) + ${params.srsl}, pmdmcode = ${params.pmdmcode} where guid = ${params.guid}`
static updateWzcshSql(params?: any): string {
const sql = `update tab_bzgl_knzy_app_hwb set hwsl = ifnull(hwsl,0) + ${params.srsl}, pmdmcode = ${params.pmdmcode} where guid = ${params.guid}`
const sql=`select hw.* from tab_bzgl_knzy_app_hwb hw inner join TAB_BZGL_KNZY_APP_HJB hj on hj.guid =hw.hjguid inner join TAB_BZGL_KNZY_APP_QYB qy on qy.guid = hj.qyguid where hw.pmdmcode is not null and hw.pmdmcode !='' and hw.hwh not like 'LS%' and hw.kfguid = '${params.kfguid}' and hw.gldwguid = '${params.gldwguid}' and hw.zmlx = ${params.zmlx}`
var sql = `select bg.*,kf.kfmc from TAB_BZGL_KNZY_APP_BGGL bg left join TAB_BZGL_KNZY_APP_DWKF kf on kf.kfdm = bg.kfdm where bg.BGZT = '${params.bgzt}' `
var sqlHz = ' order by bg.JSSJ desc'
if (params.ddh) {
return `${sql} and (bg.DDH like ${params.ddh} ${sqlHz}`;