INSERT INTO TBDA_QX(F_QXBM,F_QXMC,F_JB,F_MJ) VALUES ('001055001010','成品入库单自动采集数据',4,1)
INSERT INTO TBDA_QX(F_QXBM,F_QXMC,F_JB,F_MJ) VALUES ('001052001010','生产流动卡自动采集数据',4,1)
INSERT INTO TBDA_QX(F_QXBM,F_QXMC,F_JB,F_MJ) VALUES ('001047001011','熔炉投料单自动采集数据',4,1)
b,硬件握手:第二种是使用硬件线握手。和Tx和Rx线一样,RTS/CTS和DTR/DSR一起工作,一个作为输出,另一个作为输入。第一组线是RTS(Request to Send)和CTS(Clear to Send)。当接收方准备好接收数据,它置高RTS线表示它准备好了,如果发送方也就绪,它置高CTS,表示它即将发送数据。另一组线是DTR(Data Terminal Ready)和DSR(Data Set Ready)。这些现主要用于Modem通信。使得串口和Modem通信他们的状态。例如:当Modem已经准备好接收来自PC的数据,它置高DTR线,表示和电话线的连接已经建立。读取DSR线置高,PC机开始发送数据。一个简单的规则是DTR/DSR用于表示系统通信就绪,而RTS/CTS用于单个数据包的传输。
select
S.f_dnxh,
S.f_chbm as f_chbm_pl,
isnull(P.f_hh,'''') as f_hh,
isnull(P.f_zjf,'''') as f_zjf,
isnull(P.f_tm,'''') as f_tm,
isnull(P.f_chmc,'''') as f_chmc,
isnull(Gh.f_ghmc,'''') as f_ghmc,
isnull(P.f_ggxh,'''') as f_ggxh,
isnull(kctz.f_pc,'''') as f_pc,
S.f_rq,
S.f_dwxh as f_dwxh_pl,
case S.f_dwxh when 0 then isnull(zdw.f_jldwmc,'''') else isnull(B.f_hsdw,'''') end as f_jldw,
case S.f_dwxh when 0 then 1 else isnull(B.f_dwbl,1) end as f_dwbl,
isnull(kctz.f_srsl,0)/case S.f_dwxh when 0 then 1 else isnull(B.f_dwbl,1) end as f_sl,
isnull(fdw.f_jldwmc,'''') as f_fdw,
isnull(kctz.f_srfsl,0) as f_fsl,
isnull(kctz.f_srdj,0)*case S.f_dwxh when 0 then 1 else isnull(B.f_dwbl,1) end as f_dj,
isnull(kctz.f_srje,0) as f_je,
'''' as f_chbm_gx,
'''' as f_hh_cp,
'''' as f_zjf_cp,
'''' as f_tm_cp,
'''' as f_chmc_cp,
'''' as f_ghmc_cp,
'''' as f_ggxh_cp,
'''' as f_pc_gx,
0 as f_dwxh_gx,
'''' as f_jldw_cp,
1 as f_dwbl_cp,
0 as f_sl_cp,
'''' as f_fdw_cp,
0 as f_fsl_cp,
0 as f_dj_cp,
0 as f_je_cp,
0 as f_qfzl,
0 as f_bfzl,
0 as f_rwgzzl,
0 as f_ddgzzl,
0 as f_mz,
0 as f_gz,
isnull(kctz.f_ddh,'''') as f_ddh,
isnull(kctz.f_ddhh,0) as f_ddhh,
isnull(kctz.f_jhh,'''') as f_jhh,
isnull(kctz.f_rwh,'''') as f_rwh,
'''' as f_yybm,
'''' as f_yymc,
'''' as f_cbbz
from tbsc_rltldcb S
left outer join tbhj_kctz kctz on S.f_djhm=kctz.f_djhm and S.f_dnxh=kctz.f_dnxh and kctz.f_zy=''熔炉产出''
left outer join tbda_ch P on S.f_chbm=P.f_chbm
left outer join tbda_gh Gh on P.f_ghbm=Gh.f_ghbm
left outer join tbda_jldw fdw on P.f_jldwbm_f=fdw.f_jldwbm
left outer join tbda_jldw_dwhs B on P.f_jldwbm_z=B.f_jldwbm and S.f_dwxh=B.f_dwxh
left outer join tbda_jldw zdw on P.f_jldwbm_z=zdw.f_jldwbm
select S.f_dnxh, S.f_chbm_gx as f_chbm, isnull(P.f_hh,'''') as f_hh, isnull(P.f_zjf,'''') as f_zjf, isnull(P.f_tm,'''') as f_tm, isnull(P.f_chmc,'''') as f_chmc,
isnull(Gh.f_ghmc,'''') as f_ghmc, isnull(P.f_ggxh,'''') as f_ggxh,
kctz.f_pc,
S.f_rq,
S.f_dwxh_gx as f_dwxh,
case S.f_dwxh_gx when 0 then isnull(zdw.f_jldwmc,'''') else isnull(B.f_hsdw,'''') end as f_jldw,
case S.f_dwxh_gx when 0 then 1 else isnull(B.f_dwbl,1) end as f_dwbl,
isnull(kctz.f_srsl,0)/case S.f_dwxh_gx when 0 then 1 else isnull(B.f_dwbl,1) end as f_sl,
isnull(fdw.f_jldwmc,'''') as f_fdw,
isnull(kctz.f_srfsl,0) as f_fsl,
isnull(kctz.f_srdj,0)*case S.f_dwxh_gx when 0 then 1 else isnull(B.f_dwbl,1) end as f_dj,
isnull(kctz.f_srje,0) as f_je,
'''' as f_chbm_gx, '''' as f_hh_cp, '''' as f_zjf_cp, '''' as f_tm_cp, '''' as f_chmc_cp,
'''' as f_ghmc_cp, '''' as f_ggxh_cp,
'''' as f_pc_gx,
0 as f_dwxh_gx,
'''' as f_jldw_cp,
1 as f_dwbl_cp,
0 as f_sl_cp,
'''' as f_fdw_cp,
0 as f_fsl_cp,
0 as f_dj_cp,
0 as f_je_cp, 0 as f_qfzl, 0 as f_bfzl, 0 as f_rwgzzl, 0 as f_ddgzzl, 0 as f_mz, 0 as f_gz,
isnull(kctz.f_ddh,'''') as f_ddh,
isnull(kctz.f_ddhh,0) as f_ddhh,
isnull(kctz.f_jhh,'''') as f_jhh,
isnull(kctz.f_rwh,'''') as f_rwh,
'''' as f_yybm, '''' as f_yymc, S.f_cbbz
from tbsc_ldkcb S
left outer join tbhj_kctz kctz on S.f_djhm=kctz.f_djhm and S.f_dnxh=kctz.f_dnxh and kctz.f_zy=''本工序产出''
left outer join tbda_ch P on S.f_chbm_gx=P.f_chbm
left outer join tbda_gh Gh on P.f_ghbm=Gh.f_ghbm
left outer join tbda_jldw zdw on P.f_jldwbm_z=zdw.f_jldwbm
left outer join tbda_jldw fdw on P.f_jldwbm_f=fdw.f_jldwbm
left outer join tbda_jldw_dwhs B on P.f_jldwbm_z=B.f_jldwbm and S.f_dwxh_gx=B.f_dwxh
select
S.f_dnxh,
S.f_chbm as f_chbm_pl,
isnull(P.f_hh,'''') as f_hh,
isnull(P.f_zjf,'''') as f_zjf,
isnull(P.f_tm,'''') as f_tm,
isnull(P.f_chmc,'''') as f_chmc,
isnull(Gh.f_ghmc,'''') as f_ghmc,
isnull(P.f_ggxh,'''') as f_ggxh,
isnull(kctz.f_pc,'''') as f_pc,
S.f_rq,
S.f_dwxh as f_dwxh_pl,
case S.f_dwxh when 0 then isnull(zdw.f_jldwmc,'''') else isnull(B.f_hsdw,'''') end as f_jldw,
case S.f_dwxh when 0 then 1 else isnull(B.f_dwbl,1) end as f_dwbl,
isnull(S.f_sl,0)/case S.f_dwxh when 0 then 1 else isnull(B.f_dwbl,1) end as f_sl,
isnull(fdw.f_jldwmc,'''') as f_fdw,
isnull(S.f_fsl,0) as f_fsl,
0 as f_dj,
0 as f_je,
'''' as f_chbm_gx,
'''' as f_hh_cp,
'''' as f_zjf_cp,
'''' as f_tm_cp,
'''' as f_chmc_cp,
'''' as f_ghmc_cp,
'''' as f_ggxh_cp,
'''' as f_pc_gx,
0 as f_dwxh_gx,
'''' as f_jldw_cp,
1 as f_dwbl_cp,
0 as f_sl_cp,
'''' as f_fdw_cp,
0 as f_fsl_cp,
0 as f_dj_cp,
0 as f_je_cp,
0 as f_qfzl,
0 as f_bfzl,
0 as f_rwgzzl,
0 as f_ddgzzl,
0 as f_mz,
0 as f_gz,
isnull(kctz.f_ddh,'''') as f_ddh,
isnull(kctz.f_ddhh,0) as f_ddhh,
isnull(kctz.f_jhh,'''') as f_jhh,
isnull(kctz.f_rwh,'''') as f_rwh,
'''' as f_yybm,
'''' as f_yymc,
'''' as f_cbbz
from tbsc_rltldcb S
left outer join tbhj_kctz kctz on S.f_djhm=kctz.f_djhm and S.f_dnxh=kctz.f_dnxh
left outer join tbda_ch P on S.f_chbm=P.f_chbm
left outer join tbda_gh Gh on P.f_ghbm=Gh.f_ghbm
left outer join tbda_jldw fdw on P.f_jldwbm_f=fdw.f_jldwbm
left outer join tbda_jldw_dwhs B on P.f_jldwbm_z=B.f_jldwbm and S.f_dwxh=B.f_dwxh
left outer join tbda_jldw zdw on P.f_jldwbm_z=zdw.f_jldwbm
select
S.f_dnxh,
S.f_chbm as f_chbm_pl,
isnull(P.f_hh,'''') as f_hh,
isnull(P.f_zjf,'''') as f_zjf,
isnull(P.f_tm,'''') as f_tm,
isnull(P.f_chmc,'''') as f_chmc,
isnull(Gh.f_ghmc,'''') as f_ghmc,
isnull(P.f_ggxh,'''') as f_ggxh,
isnull(kctz.f_pc,'''') as f_pc,
S.f_rq,
S.f_dwxh as f_dwxh_pl,
case S.f_dwxh when 0 then isnull(zdw.f_jldwmc,'''') else isnull(B.f_hsdw,'''') end as f_jldw,
case S.f_dwxh when 0 then 1 else isnull(B.f_dwbl,1) end as f_dwbl,
isnull(kctz.f_fcsl,0)/case S.f_dwxh when 0 then 1 else isnull(B.f_dwbl,1) end as f_sl,
isnull(fdw.f_jldwmc,'''') as f_fdw,
isnull(kctz.f_fcfsl,0) as f_fsl,
isnull(kctz.f_fcdj,0)*case S.f_dwxh when 0 then 1 else isnull(B.f_dwbl,1) end as f_dj,
isnull(kctz.f_fcje,0) as f_je,
'''' as f_chbm_gx,
'''' as f_hh_cp,
'''' as f_zjf_cp,
'''' as f_tm_cp,
'''' as f_chmc_cp,
'''' as f_ghmc_cp,
'''' as f_ggxh_cp,
'''' as f_pc_gx,
0 as f_dwxh_gx,
'''' as f_jldw_cp,
1 as f_dwbl_cp,
0 as f_sl_cp,
'''' as f_fdw_cp,
0 as f_fsl_cp,
0 as f_dj_cp,
0 as f_je_cp,
0 as f_qfzl,
0 as f_bfzl,
0 as f_rwgzzl,
0 as f_ddgzzl,
0 as f_mz,
0 as f_gz,
isnull(kctz.f_ddh,'''') as f_ddh,
isnull(kctz.f_ddhh,0) as f_ddhh,
isnull(kctz.f_jhh,'''') as f_jhh,
isnull(kctz.f_rwh,'''') as f_rwh,
'''' as f_yybm,
'''' as f_yymc,
'''' as f_cbbz
from tbsc_rltldcb S
left outer join tbhj_kctz kctz on S.f_djhm=kctz.f_djhm and S.f_dnxh=kctz.f_dnxh
left outer join tbda_ch P on S.f_chbm=P.f_chbm
left outer join tbda_gh Gh on P.f_ghbm=Gh.f_ghbm
left outer join tbda_jldw fdw on P.f_jldwbm_f=fdw.f_jldwbm
left outer join tbda_jldw_dwhs B on P.f_jldwbm_z=B.f_jldwbm and S.f_dwxh=B.f_dwxh
left outer join tbda_jldw zdw on P.f_jldwbm_z=zdw.f_jldwbm