📄 unit_zishenrenwj.pas
字号:
+' and b.zblx_id='+xmbdgc.BDLX_ID;
adoquery.Open;
if adoquery.fieldbyname('dwbm_id').AsString='' then maxdwbm:='1'
else maxdwbm:=adoquery.fieldbyname('dwbm_id').AsString;
maxdwbm:=inttostr(strtoint(maxdwbm)+1);
adoquery.Close;
adoquery.SQL.Text:='insert into bid_wenjian2(dwbm_id,dw_id,wj2_fhx,WJ2_LEIXING,wj2_QZX,xmgczb_id) select '
+trim(maxdwbm)+',a.dw_id,1,1,1,xmgczb_id from bid_danwei_xinxi A,bid_xmgczb b where dw_name='''
+trim(listview2.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) select '
+' a.dw_id,b.xmgczb_id from '
+' bid_danwei_xinxi A,bid_xmgczb b where dw_name='''+trim(listview2.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) select '
+' a.dw_id,b.xmgczb_id from '
+' bid_danwei_xinxi A,bid_xmgczb b where dw_name='''+trim(listview2.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) select a.dw_id,b.xmgczb_id from '
+' bid_danwei_xinxi A,bid_xmgczb b where dw_name='''+trim(listview2.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;
getlist;
end;
procedure TFrm_ZiShenRenwj.Button1Click(Sender: TObject);
var
adoquery:tadoquery;
begin
inherited;
if com_zhaobiao.Text='施工' then
begin
if (LeibieExist(com_leibie.text)) and (com_leibie.ItemIndex<>0) then
begin
showmessage('该项目没有该类别');
com_leibie.ItemIndex:=0;
exit;
end;
adoquery:=tadoquery.Create(nil);
try
adoquery.Connection:=datamodule1.ADOMainConn;
datamodule1.ADOMainConn.BeginTrans;
try
adoquery.Close;
{if com_leibie.items.IndexOf(com_leibie.Text)<=0 then
adoquery.SQL.text:='update bid_wenjian2 set wJ2_SHOWNAME='''+trim(edt_wdname.Text)+''',wj2_miaoshu='''+trim(memo_ms.Text)
+''' where WJ2_leixing=1 and dw_id in(select dw_id from bid_danwei_xinxi where dw_name='''+trim(edt_dwname.Text)
+''') 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 +')'
else if com_leibie.items.IndexOf(com_leibie.Text)>0 then}
adoquery.sql.Text:='update bid_wenjian2 set wj2_leibie='+trim(getleibie(com_leibie.text))
+',wJ2_SHOWNAME='''+trim(edt_wdname.Text)+''',wj2_miaoshu='''+trim(memo_ms.Text)
+''' where WJ2_leixing=1 and dw_id in(select dw_id from bid_danwei_xinxi where dw_name='''+trim(edt_dwname.Text)
+''') 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 +')';
adoquery.ExecSQL;
datamodule1.ADOMainConn.CommitTrans;
except
datamodule1.ADOMainConn.RollbackTrans;
end;
finally
freeandnil(adoquery);
end;
end;
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(edt_dwname.Text)
+''') 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.Close;
datamodule1.ADOMainConn.BeginTrans;
try
adoquery.SQL.Text:=' update bid_wenjian2 set bd_isbn=b.bd_isbn,wJ2_SHOWNAME='''+trim(edt_wdname.Text)+''',wj2_miaoshu='''
+trim(memo_ms.Text)+''' 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(edt_dwname.Text)
+''') 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)+''''
+' update bid_fhx set bd_isbn=b.bd_isbn from bid_fhx a, bid_biaoduan_xinxi b'
+' where dw_id in(select dw_id from bid_danwei_xinxi where dw_name='''+trim(edt_dwname.Text)
+''') 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)+''''
+' update bid_qzx set bd_isbn=b.bd_isbn from bid_qzx a, bid_biaoduan_xinxi b'
+' where dw_id in(select dw_id from bid_danwei_xinxi where dw_name='''+trim(edt_dwname.Text)
+''') 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)+'''';
adoquery.ExecSQL;
datamodule1.ADOMainConn.CommitTrans;
except
datamodule1.ADOMainConn.RollbackTrans;
end;
finally
freeandnil(adoquery);
end;
end;
getlist;
end;
procedure TFrm_ZiShenRenwj.Button4Click(Sender: TObject);
var
adoquery:tadoquery;
begin
inherited;
if application.MessageBox('申请人将要按照拼音顺序重新排列','请确认',MB_YESNO)<>mryes then exit;
adoquery:=tadoquery.Create(nil);
try
adoquery.Connection:=datamodule1.ADOMainConn;
adoquery.Close;
datamodule1.ADOMainConn.BeginTrans;
try
adoquery.SQL.Text:=' select identity(int,1,1) as id,a.dw_id,a.xmgczb_id,a.wj2_leixing into #bid_linshi from (select top 500 '
+' a.dw_id,a.xmgczb_id,A.wj2_leixing from bid_wenjian2 a, '
+' bid_xmgczb b,bid_danwei_xinxi c where A.wj2_leixing=1 and c.dw_id=a.dw_id '
//+' and a.wj2_qzx=1
+' and a.xmgczb_id=b.xmgczb_id AND B.xm_isbn='''
+trim(xmbdgc.XM_ISBn)+''' and B.gclx_id='+xmbdgc.gCLX_ID
+' and B.zblx_id='+xmbdgc.BDLX_ID
+' group by dwbm_id, a.dw_id,a.xmgczb_id,A.wj2_leixing,c.dw_name'
+' order by c.dw_name ) A '
+' update bid_wenjian2 set dwbm_ID=A.ID FROM #bid_linshi a,bid_wenjian2 b '
+' where a.dw_id=b.dw_id and a.xmgczb_id=b.xmgczb_id and a.wj2_leixing=b.wj2_leixing '
+' drop table #bid_linshi';
adoquery.ExecSQL;
datamodule1.ADOMainConn.CommitTrans;
except
datamodule1.ADOMainConn.RollbackTrans;
end;
finally
freeandnil(adoquery);
end;
end;
procedure TFrm_ZiShenRenwj.btn_delClick(Sender: TObject);
var
adoquery:tadoquery;
begin
inherited;
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;
getList;
end;
procedure TFrm_ZiShenRenwj.btn_addClick(Sender: TObject);
var
adoquery:Tadoquery;
begin
{ inherited;
adoquery:=tadoquery.Create(nil);
try
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(edt_dwname.Text)
+''') 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.Close;
datamodule1.ADOMainConn.BeginTrans;
try
adoquery.SQL.Text:=' if (select count(*) from bid_wenjian2 a,bid_biaoduan_xinxi b,'
+'bid_danwei_xinxi c where a.wj2_leixing=1 and a.bd_isbn=b.bd_isbn 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+'))=0 begin'
+' insert into bid_WENJIAN2(dw_id,xmgczb_id,dwbm_id,bd_isbn,wJ2_SHOWNAME,wj2_miaoshu,wj2_leixing) select a.dw_id,a.xmgczb_id,'
+'dwbm_id,b.bd_isbn,'''+trim(edt_wdname.Text)+''','''+trim(memo_ms.Text)+''',1 from bid_wenjian2 a,bid_biaoduan_xinxi b,'
+'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+')'
+';'
+' insert into bid_fhx(dw_id,xmgczb_id,bd_isbn) select a.dw_id,a.xmgczb_id,'
+'b.bd_isbn from bid_wenjian2 a,bid_biaoduan_xinxi b,'
+'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 '
+';'
+' insert into bid_qzx(dw_id,xmgczb_id,bd_isbn) select a.dw_id,a.xmgczb_id,'
+'b.bd_isbn from bid_wenjian2 a,bid_biaoduan_xinxi b,'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -