📄 unit_zishenrenwj.pas
字号:
+'bid_danwei_xinxi c where a.xmgczb_id=b.xmgczb_id and b.bd_name='''+trim(com_leibie.Text)+''' and c.dw_name='''
+trim(edt_dwname.Text)+''' and a.dw_id=c.dw_Id and b.xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+') group by a.dw_id,a.xmgczb_id,b.bd_isbn end';
adoquery.ExecSQL;
datamodule1.ADOMainConn.CommitTrans;
except
datamodule1.ADOMainConn.RollbackTrans;
end;
finally
freeandnil(adoquery);
end;
getlist; }
end;
procedure TFrm_ZiShenRenwj.SpeedButton2Click(Sender: TObject);
var
adoquery:tadoquery;
maxdwbm:string;
begin
inherited;
if (com_leibie.ItemIndex<0) or (listview3.Selected=nil) then exit;
if com_zhaobiao.Text='施工' then
begin
adoquery:=tadoquery.Create(nil);
try
adoquery.Close;
adoquery.Connection:=datamodule1.ADOMainConn;
adoquery.SQL.Text:='select * from bid_wenjian2 a,bid_danwei_xinxi b where a.dw_id=b.dw_Id'
+' and b.dw_name='+quotedstr(trim(listview3.Selected.Caption))+' and a.xmgczb_id in (select xmgczb_id from bid_xmgczb where '
+' xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID +') and wj2_leixing=1 and wj2_leibie='+getleibie(com_leibie.Text);
adoquery.Open;
if adoquery.RecordCount>0 then
begin
showmessage('该单位已投了该类别');
freeandnil(adoquery);
exit;
end;
adoquery.SQL.Clear;
adoquery.SQL.Text:=' if (select count(*) from bid_wenjian2 a,bid_danwei_xinxi b where a.dw_id=b.dw_id and wj2_leixing=1'
+' and b.dw_name='+quotedstr(listview3.selected.caption)+' and a.xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+'))>0 begin'
+' select dwbm_id as dwbm_id from bid_wenjian2 a,bid_danwei_xinxi b where a.dw_id=b.dw_id and dw_name='
+quotedstr(listview3.selected.caption)
+' and a.xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+') end else begin'
+' select max(dwbm_id)+1 as dwbm_id from bid_wenjian2 a,bid_xmgczb b where a.xmgczb_id= b.xmgczb_id '
+'and a.WJ2_leixing=1 and b.xm_isbn='''
+trim(xmbdgc.XM_ISBn)+''' and b.gclx_id='+xmbdgc.gCLX_ID
+' and b.zblx_id='+xmbdgc.BDLX_ID+' end';
adoquery.Open;
maxdwbm:=adoquery.fieldbyname('dwbm_id').AsString;
if maxdwbm='' then maxdwbm:='1';
adoquery.Close;
datamodule1.ADOMainConn.BeginTrans;
try
adoquery.SQL.Text:='insert into bid_wenjian2(dwbm_id,dw_id,wj2_fhx,WJ2_LEIXING,wj2_QZX,xmgczb_id,wj2_leibie) select '
+trim(maxdwbm)+',a.dw_id,1,1,1,xmgczb_id,'+getleibie(com_leibie.text)
+' from bid_danwei_xinxi A,bid_xmgczb b where dw_name='''
+trim(listview3.Selected.caption)+''' and b.xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and b.gclx_id='+xmbdgc.gCLX_ID
+' and b.zblx_id='+xmbdgc.BDLX_ID
+' insert into bid_fhx(dw_id,xmgczb_id,BD_LEIBIE) select '
+' a.dw_id,b.xmgczb_id,'+GetLeibie(com_leibie.text)+' from '
+' bid_danwei_xinxi A,bid_xmgczb b where dw_name='''+trim(listview3.Selected.caption)
+''' and b.xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and b.gclx_id='+xmbdgc.gCLX_ID
+' and b.zblx_id='+xmbdgc.BDLX_ID
+' insert into bid_qzx(dw_id,xmgczb_id,bd_leibie) select '
+' a.dw_id,b.xmgczb_id,'+GetLeibie(com_leibie.text)+' from '
+' bid_danwei_xinxi A,bid_xmgczb b where dw_name='''+trim(listview3.Selected.caption)
+''' and b.xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and b.gclx_id='+xmbdgc.gCLX_ID
+' and b.zblx_id='+xmbdgc.BDLX_ID
+' insert into bid_yushen_defen(dw_ID,xmgczb_id,bd_leibie) select a.dw_id,b.xmgczb_id,'+GetLeibie(com_leibie.text)
+' from bid_danwei_xinxi A,bid_xmgczb b where dw_name='''+trim(listview3.Selected.caption)
+''' and b.xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and b.gclx_id='+xmbdgc.gCLX_ID
+' and b.zblx_id='+xmbdgc.BDLX_ID;
adoquery.ExecSQL;
datamodule1.ADOMainConn.CommitTrans;
except
datamodule1.ADOMainConn.RollbackTrans;
end;
finally
freeandnil(adoquery);
end;
end
else if com_zhaobiao.Text='监理' then
begin
adoquery:=tadoquery.Create(nil);
try
adoquery.Close;
adoquery.Connection:=datamodule1.ADOMainConn;
adoquery.SQL.Text:='select * from bid_wenjian2 a,bid_biaoduan_xinxi b'
+' where WJ2_leixing=1 and dw_id in(select dw_id from bid_danwei_xinxi where dw_name='''
+trim(listview3.Selected.Caption)
+''') and a.xmgczb_id in (select xmgczb_id from bid_xmgczb where '
+' xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID +') and a.xmgczb_id=b.xmgczb_id and b.bd_name='''
+trim(com_leibie.Text)+''' and a.bd_isbn=b.bd_isbn';
adoquery.Open;
if adoquery.RecordCount>0 then
begin
freeandnil(adoquery);
showmessage('该单位已投了该标段');
exit;
end;
adoquery.SQL.Clear;
adoquery.SQL.Text:=' if (select count(*) from bid_wenjian2 a,bid_danwei_xinxi b where a.dw_id=b.dw_id and wj2_leixing=1'
+' and b.dw_name='+quotedstr(listview3.selected.caption)+' and a.xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+'))>0 begin'
+' select dwbm_id as dwbm_id from bid_wenjian2 a,bid_danwei_xinxi b where a.dw_id=b.dw_id and dw_name='
+quotedstr(listview3.selected.caption)
+' and a.xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+') end else begin'
+' select max(dwbm_id)+1 as dwbm_id from bid_wenjian2 a,bid_xmgczb b where a.xmgczb_id= b.xmgczb_id '
+'and a.WJ2_leixing=1 and b.xm_isbn='''
+trim(xmbdgc.XM_ISBn)+''' and b.gclx_id='+xmbdgc.gCLX_ID
+' and b.zblx_id='+xmbdgc.BDLX_ID+' end';
adoquery.Open;
maxdwbm:=adoquery.fieldbyname('dwbm_id').AsString;
if maxdwbm='' then maxdwbm:='1';
adoquery.Close;
datamodule1.ADOMainConn.BeginTrans;
try
adoquery.SQL.Text:='insert into bid_WENJIAN2(dw_id,xmgczb_id,dwbm_id,bd_isbn,wJ2_SHOWNAME,wj2_miaoshu,wj2_leixing,'
+'wj2_fhx,wj2_qzx) select c.dw_id,b.xmgczb_id,'
+Maxdwbm+',b.bd_isbn,'''+trim(edt_wdname.Text)+''','''+trim(memo_ms.Text)+''',1,1,1 from bid_biaoduan_xinxi b,'
+'bid_danwei_xinxi c where b.bd_name='''+trim(com_leibie.Text)+''' and c.dw_name='''
+trim(listview3.Selected.Caption)+''' and b.xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+')'
+';'
+' insert into bid_fhx(dw_id,xmgczb_id,bd_isbn) select c.dw_id,b.xmgczb_id,'
+'b.bd_isbn from bid_biaoduan_xinxi b,'
+'bid_danwei_xinxi c where b.bd_name='''+trim(com_leibie.Text)+''' and c.dw_name='''
+trim(listview3.Selected.Caption)+''' and b.xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+')'
+';'
+' insert into bid_qzx(dw_id,xmgczb_id,bd_isbn) select C.dw_id,B.xmgczb_id,'
+'b.bd_isbn from bid_biaoduan_xinxi b,'
+'bid_danwei_xinxi c where b.bd_name='''+trim(com_leibie.Text)+''' and c.dw_name='''
+trim(listview3.Selected.Caption)+''' and b.xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+')';
adoquery.ExecSQL;
datamodule1.ADOMainConn.CommitTrans;
except
datamodule1.ADOMainConn.RollbackTrans;
end;
finally
freeandnil(adoquery);
end;
end;
getList;
end;
procedure TFrm_ZiShenRenwj.SpeedButton3Click(Sender: TObject);
var
adoquery:tadoquery;
begin
inherited;
if listview1.selected=nil then exit;
if com_zhaobiao.Text='施工' then
begin
adoquery:=tadoquery.Create(nil);
try
adoquery.Close;
adoquery.Connection:=datamodule1.ADOMainConn;
datamodule1.ADOMainConn.BeginTrans;
try
adoquery.SQL.Text:='delete from bid_wenjian2 where WJ2_leixing=1 and xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+') and dw_id in (select dw_id from bid_danwei_xinxi '
+' where dw_name='''+trim(listview1.Selected.caption)+''') and wj2_leibie='+GetLeibie(com_leibie.text)
+' delete from bid_fhx from bid_fhx where '
+' xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+') and dw_id in (select dw_id from bid_danwei_xinxi '
+' where dw_name='''+trim(listview1.Selected.caption)+''') and bd_leibie='+GetLeibie(com_leibie.text)
+';'
+' delete from bid_qzx from bid_qzx where '
+' xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+') and dw_id in (select dw_id from bid_danwei_xinxi '
+' where dw_name='''+trim(listview1.Selected.caption)+''') and bd_leibie='+GetLeibie(com_leibie.text)
+' delete from bid_yushen_defen from bid_yushen_defen where '
+' xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+') and dw_id in (select dw_id from bid_danwei_xinxi '
+' where dw_name='''+trim(listview1.Selected.caption)+''') and bd_leibie='+GetLeibie(com_leibie.text);
adoquery.ExecSQL;
datamodule1.ADOMainConn.CommitTrans;
except
datamodule1.ADOMainConn.RollbackTrans;
end;
finally
freeandnil(adoquery);
end;
end
else if com_zhaobiao.Text='监理' then
begin
adoquery:=tadoquery.Create(nil);
try
adoquery.Close;
adoquery.Connection:=datamodule1.ADOMainConn;
datamodule1.ADOMainConn.BeginTrans;
try
adoquery.SQL.Text:='delete from bid_wenjian2 where wj2_leixing=1 and dw_id in (select dw_Id from bid_danwei_xinxi '
+' where dw_name='''+trim(listview1.Selected.Caption)+''')'
+' and xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+') and bd_isbn in (select bd_isbn from bid_biaoduan_xinxi where'
+' xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+') and bd_name='''+trim(trim(listview1.Selected.SubItems[1]))+''')'
+';'
+' delete from bid_fhx from bid_fhx where dw_id in (select dw_Id from bid_danwei_xinxi '
+' where dw_name='''+trim(listview1.Selected.Caption)+''')'
//+' and b.dwbm_id='+trim(listview1.Selected.Caption)
+' and xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+') and bd_isbn in (select bd_isbn from bid_biaoduan_xinxi where'
+' xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+') and bd_name='''+trim(trim(listview1.Selected.SubItems[1]))+''')'
+';'
+' delete from bid_qzx from bid_qzx where dw_id in (select dw_Id from bid_danwei_xinxi '
+' where dw_name='''+trim(listview1.Selected.Caption)+''')'// a.dw_id=b.dw_id and b.dwbm_id='+trim(listview1.Selected.Caption)
+' and xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+') and bd_isbn in (select bd_isbn from bid_biaoduan_xinxi where'
+' xmgczb_id in (select xmgczb_id from bid_xmgczb'
+' where xm_isbn='''+trim(xmbdgc.XM_ISBn)+''' and gclx_id='+xmbdgc.gCLX_ID
+' and zblx_id='+xmbdgc.BDLX_ID+') and bd_name='''+trim(trim(listview1.Selected.SubItems[1]))+''')';
adoquery.ExecSQL;
datamodule1.ADOMainConn.CommitTrans;
except
datamodule1.ADOMainConn.RollbackTrans;
end;
finally
freeandnil(adoquery);
end;
end;
getList;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -