📄 unit_yaohao.pas
字号:
unit Unit_yaohao;
interface
uses
unit_parentform,Dialogs,forms,SysUtils,DB, ADODB,Controls,windows;
type
TFrm_YaoHao = class(TFrm_ParentForm)
procedure FormCreate(Sender: TObject);
procedure Com_xmnameChange(sender:Tobject);
procedure Com_zhaoBiaoChange(Sender:Tobject);
procedure Com_GclxnameChange(Sender: TObject);
procedure com_projectchange(sender:tobject);
procedure btn_xiangxiclick(Sender:tobject);
procedure bb_reflashClick(Sender: TObject);
procedure com_leibieChange(Sender: TObject);
procedure Cell1MouseLClick(Sender: TObject; col, row,updn: Integer);
procedure Cell1MouseRClick(Sender: TObject; col, row,updn: Integer);
procedure LoadDateSource;
procedure BitBtn2Click(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure Edit1Exit(Sender: TObject);
procedure getcol;
procedure updateyaohao;
procedure Cell1EditFinish(Sender: TObject;var text: WideString; var approve: Integer);
//对序列排序
private
ecol:string;
end;
var
Frm_YaoHao :TFrm_YaoHao;
implementation
uses
unit_public,SystemObject,DataModule,DataAccessCommonShell;
const
sqr:WideString='dd'; //编号用变量
procedure TFrm_YaoHao.LoadDateSource;
var
adoquery,ADOQUERY1:Tadoquery;
ssql,top,str:string;
i,j,ipage,irow:Integer;
sqrhm,bd_name:string;
begin
if com_project.ItemIndex=0 then
begin
cell1.OpenFile(SPATH+'\report\Others\tbpeihao.cll','');
cell1.ShowSideLabel(0, 0); //不显示行标
cell1.ShowTopLabel(0, 0); //不显示列标
//if com_leibie.itemindex<0 then EXIT;
adoquery:=tadoquery.Create(nil);
try
adoquery.Connection:=datamodule1.ADOMainConn;
adoquery.Close;
adoquery.SQL.Text:='select cs_renshu from bid_canshu_SAVE 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+') ';
adoquery.open;
top:=adoquery.fieldbyname('cs_renshu').AsString;
if top='' then
begin
freeandnil(adoquery);
exit;
end;
adoquery.Close;
{if com_leibie.ITEMS.IndexOf(COM_LEIBIE.Text)=0 then
adoquery.SQL.Text:='select a.sqrhm,b.dw_name,c.wj2_tgduanshu from bid_shenqingrhm a,'
+' bid_danwei_xinxi b,bid_wenjian2 c where C.wj2_leixing=1 and a.dw_id=b.dw_id and b.dw_id=c.dw_id '
+' and a.xmgczb_id=c.xmgczb_id 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+') order by a.sqrhm '
else IF com_leibie.ITEMS.IndexOf(COM_LEIBIE.Text)>0 THEN }
if (com_leibie.ItemIndex>=0) and (getleibie(com_leibie.Text)='-1') then
begin
adoquery.SQL.Text:='select a.sqrhm,b.dw_name,c.wj2_tgduanshu from bid_shenqingrhm a,'
+' bid_danwei_xinxi b,bid_wenjian2 c where C.wj2_leixing=1 and a.dw_id=b.dw_id and b.dw_id=c.dw_id '
+' and a.xmgczb_id=c.xmgczb_id 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.bd_leibie=c.wj2_leibie order by a.sqrhm';
end
else
begin
adoquery.SQL.Text:='select a.sqrhm,b.dw_name,c.wj2_tgduanshu from bid_shenqingrhm a,'
+' bid_danwei_xinxi b,bid_wenjian2 c where C.wj2_leixing=1 and a.dw_id=b.dw_id and b.dw_id=c.dw_id '
+' and a.xmgczb_id=c.xmgczb_id 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 c.wj2_leibie='+GetLeiBie(com_leibie.text)+' AND a.bd_leibie=c.wj2_leibie order by a.sqrhm';
end;
adoquery.open;
if strtoint(GetLeiBie(com_leibie.text))>0 then
cell1.SetCellString(1,4,0,com_leibie.text)
else
cell1.SetCellString(1,4,0,' ');
if adoquery.RecordCount=0 then exit;
setCellSheet(cell1,adoquery.RecordCount,21);
for i:=0 to adoquery.RecordCount-1 do
begin
iPage:=(i) div 21;
irow:=(i) mod 21;
cell1.SetCellString(1,irow+6,ipage, adoquery.fieldbyname('sqrhm').AsString);
cell1.SetCellString(2,irow+6,ipage,adoquery.fieldbyname('dw_name').AsString);
cell1.SetCellString(3,irow+6,ipage,adoquery.fieldbyname('wj2_TGDUANSHU').AsString);
sqrhm:='';
for J:=0 to adoquery.fieldbyname('wj2_TGDUANSHU').asinteger-1 do
begin
sqrhm:=sqrhm+' {'+adoquery.fieldbyname('sqrhm').AsString+'}';
end;
cell1.SetCellString(4,irow+6,ipage,sqrhm);
adoquery.Next;
end;
finally
freeandnil(adoquery);
END;
exit;
end;
if com_project.ItemIndex=1 then
begin
adoquery:=tadoquery.Create(nil);
try
adoquery.connection:=datamodule1.ADOMainConn;
{if com_leibie.ITEMS.IndexOf(COM_LEIBIE.Text)=0 then
adoquery.SQL.Text:='select a.bd_bianhao,a.bd_name,C.yh_xuhao,C.sqrhm from bid_biaoduan_xinxi a '
+' LEFT JOIN (SELECT B.BD_ISBN,B.DW_ID,SQRHM,YH_XUHAO,B.XMGCZB_ID FROM bid_yaohao_jieguo B,Bid_shenqingrhm D WHERE '
+' B.DW_ID=D.DW_ID AND B.XMGCZB_ID=D.XMGCZB_ID) C ON A.XMGCZB_ID=C.XMGCZB_ID '
+' AND a.bd_isbn=C.bd_isbn WHERE 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+') order by a.bd_bianhao'
else if com_leibie.ITEMS.IndexOf(COM_LEIBIE.Text)>0 then}
adoquery.SQL.Text:='select a.bd_bianhao,a.bd_name,C.yh_xuhao,C.sqrhm from bid_biaoduan_xinxi a '
+' LEFT JOIN (SELECT B.BD_ISBN,B.DW_ID,SQRHM,YH_XUHAO,B.XMGCZB_ID FROM bid_yaohao_jieguo B,Bid_shenqingrhm D WHERE '
+' B.DW_ID=D.DW_ID AND B.XMGCZB_ID=D.XMGCZB_ID) C ON A.XMGCZB_ID=C.XMGCZB_ID '
+' AND a.bd_isbn=C.bd_isbn WHERE 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.bd_leibie='+GetLeiBie(com_leibie.Text)+' order by a.bd_bianhao';
adoquery.Open;
if adoquery.RecordCount=0 then
begin
freeandnil(adoquery);
exit;
end;
adoquery.First;
i:=0;
bd_name:='';
while not adoquery.Eof do //获得行数
begin
if bd_name<> adoquery.fieldbyname('bd_name').AsString then
i:=i+1;
bd_name:=adoquery.fieldbyname('bd_name').AsString;
adoquery.Next;
end;
setCellSheet(cell1,i,10);
adoquery.First;
i:=0;
bd_name:='';
irow:=0;
ipage:=0;
while not adoquery.Eof do
begin
if adoquery.fieldbyname('bd_name').AsString=bd_name then
begin
if adoquery.fieldbyname('yh_xuhao').AsInteger>0 then
cell1.SetCellString(adoquery.fieldbyname('yh_xuhao').AsInteger+1,irow+6,ipage,adoquery.fieldbyname('sqrhm').AsString);
end
else
begin
i:=i+1;
iPage:=(i-1) div 10;
irow:=(i-1) mod 10;
cell1.SetCellString(1,irow+6,ipage,adoquery.fieldbyname('bd_name').AsString);
if adoquery.fieldbyname('yh_xuhao').AsInteger>0 then
cell1.SetCellString(adoquery.fieldbyname('yh_xuhao').AsInteger+1,irow+6,ipage,adoquery.fieldbyname('sqrhm').AsString);
bd_name:=adoquery.fieldbyname('bd_name').AsString;
end;
adoquery.Next;
end;
finally
freeandnil(adoquery);
END;
end;
if com_project.ItemIndex=2 then
begin
adoquery:=tadoquery.Create(nil);
try
adoquery.Connection:=datamodule1.ADOMainConn;
{if com_leibie.ITEMS.IndexOf(COM_LEIBIE.Text)=0 then
adoquery.sql.Text:=' select E.sqrhm,c.dw_name,d.bd_bianhao from bid_yaohao_Jieguo a,bid_shenqingrhm b, '
+' BID_SHENQINGRHM E, bid_danwei_xinxi c,bid_biaoduan_xinxi d where '
+' E.DW_ID=A.DW_ID AND E.XMGCZB_ID=A.XMGCZB_ID AND a.DW_ID=b.DW_ID and b.dw_id=c.dw_id and '
+' a.xmgczb_id=d.xmgczb_id and a.xmgczb_id=b.xmgczb_id 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.bd_isbn=d.bd_isbn order by E.sqrhm '
else if com_leibie.ITEMS.IndexOf(COM_LEIBIE.Text)>0 then}
adoquery.sql.Text:=' select B.sqrhm,c.dw_name,d.bd_bianhao from bid_yaohao_Jieguo a,bid_shenqingrhm b, '
+' BID_SHENQINGRHM E, bid_danwei_xinxi c,bid_biaoduan_xinxi d where '
+' E.DW_ID=A.DW_ID AND E.XMGCZB_ID=A.XMGCZB_ID AND a.DW_id=b.dw_Id and b.dw_id=c.dw_id and '
+' d.bd_leibie='+GetLeiBie(com_leibie.Text)+' and '
+' a.xmgczb_id=d.xmgczb_id and a.xmgczb_id=b.xmgczb_id 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.bd_isbn=d.bd_isbn order by E.sqrhm ';
adoquery.Open;
if adoquery.RecordCount=0 then
begin
freeandnil(adoquery);
exit;
end;
adoquery.First;
i:=0 ;
bd_name:='';
while not adoquery.Eof do
begin
if bd_name<>adoquery.FieldByName('sqrhm').AsString then
begin
i:=i+1;
bd_name:=adoquery.fieldbyname('sqrhm').AsString;
end;
adoquery.Next;
end;
setCellSheet(cell1,i,27);
adoquery.First;
i:=0;
bd_name:='';
irow:=0;
ipage:=0;
while not adoquery.Eof do
begin
if adoquery.fieldbyname('sqrhm').AsString=bd_name then
begin
for j:=3 to cell1.GetCols(0) do
begin
if cell1.GetCellString(j,6,ipage)=adoquery.FieldByName('bd_bianhao').AsString then
break;
end;
if j<=cell1.getcols(0) then
cell1.SetCellString(j,irow+7,ipage,'▲');
end
else
begin
i:=i+1;
iPage:=(i-1) div 27;
irow:=(i-1) mod 27;
cell1.SetCellString(1,irow+7,ipage,adoquery.fieldbyname('sqrhm').AsString);
cell1.SetCellString(2,irow+7,ipage,adoquery.fieldbyname('dw_name').AsString);
for j:=3 to cell1.GetCols(0) do
begin
//showmessage(cell1.GetCellString(j,7,ipage));
if cell1.GetCellString(j,6,ipage)=adoquery.FieldByName('bd_bianhao').AsString then
break;
end;
if j<=cell1.getcols(0) then
cell1.SetCellString(j,irow+7,ipage,'▲');
bd_name:=adoquery.fieldbyname('sqrhm').AsString;
end;
adoquery.Next;
end;
finally
freeandnil(adoquery);
END;
end;
cell1.SetCurSheet(0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -