D7myYunxiang/云翔基础资料(BaseInfoYX.dll)/U_BPZdy_LRSHK_BF.pas

972 lines
27 KiB
ObjectPascal
Raw Normal View History

2025-01-20 13:04:03 +08:00
unit U_BPZdy_LRSHK_BF;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, ToolWin, ComCtrls,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel,
cxClasses, cxControls, cxGridCustomView, cxGrid, DBClient, ADODB, ImgList,
StdCtrls, ExtCtrls, cxTextEdit, cxGridCustomPopupMenu, cxGridPopupMenu,
cxButtonEdit, BtnEdit, cxTL, cxMaskEdit, cxInplaceContainer, cxDBTL,
cxTLData, cxContainer, cxCurrencyEdit, cxCheckBox, cxSplitter,jpeg,U_SLT_PBSK,U_SLT,Math, Menus, cxCalendar;
type
TfrmBPZDY_LRSHK_BF = class(TForm)
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
DataSource1: TDataSource;
ClientDataSet1: TClientDataSet;
ADOConnection1: TADOConnection;
ThreeImgList: TImageList;
DataSource2: TDataSource;
ML_GYS: TClientDataSet;
DataSource3: TDataSource;
ML_GX: TClientDataSet;
ADOQuery6: TADOQuery;
ADOQuery2: TADOQuery;
ADOQuery3: TADOQuery;
Panel2: TPanel;
Panel4: TPanel;
Panel5: TPanel;
DataSource4: TDataSource;
ADOQueryTree: TADOQuery;
Order_Tree: TClientDataSet;
Panel6: TPanel;
cxGrid1: TcxGrid;
TV1: TcxGridDBTableView;
V1BPCode: TcxGridDBColumn;
V1BPName: TcxGridDBColumn;
V1BPMF1: TcxGridDBColumn;
V1BPKZ: TcxGridDBColumn;
V1BPJS: TcxGridDBColumn;
v1BPMiDu: TcxGridDBColumn;
V1BPID: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
Panel7: TPanel;
cxDBTreeList1: TcxDBTreeList;
cxDBTreeList1cxDBTreeListColumn2: TcxDBTreeListColumn;
cxGridPopupMenu1: TcxGridPopupMenu;
cxGridPopupMenu2: TcxGridPopupMenu;
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
V1Column1: TcxGridDBColumn;
cxStyleRepository2: TcxStyleRepository;
cxStyle2: TcxStyle;
V1Column2: TcxGridDBColumn;
cxSplitter1: TcxSplitter;
ScrollBox1: TScrollBox;
ToolBar2: TToolBar;
TSH: TToolButton;
ToolBar1: TToolBar;
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
BPNameM: TEdit;
BPCodeM: TEdit;
TBClose: TToolButton;
adoqueryPicture: TADOQuery;
ScrollBox2: TScrollBox;
Panel3: TPanel;
Button1: TButton;
THB: TToolButton;
V1Ssel: TcxGridDBColumn;
TCF: TToolButton;
V1SKID: TcxGridDBColumn;
ToolButton1: TToolButton;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBSaveClick(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BPNamehange(Sender: TObject);
procedure V1NotePropertiesEditValueChanged(Sender: TObject);
procedure V1HelpTypePropertiesEditValueChanged(Sender: TObject);
procedure v1note1PropertiesEditValueChanged(Sender: TObject);
procedure V1BPCodePropertiesEditValueChanged(Sender: TObject);
procedure V1BPNamePropertiesEditValueChanged(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure BPCodeMChange(Sender: TObject);
procedure Tv3CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
procedure TPBLBClick(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure cxDBTreeList1Click(Sender: TObject);
procedure TSHClick(Sender: TObject);
procedure TV1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button1Click(Sender: TObject);
procedure THBClick(Sender: TObject);
procedure TCFClick(Sender: TObject);
private
FBPID,FCPID,FCPNo,FCPName:string;
procedure InitGrid();
procedure SaveData();
procedure initTree();
{ Private declarations }
public
flag,flagname,snote,MainType,FGYName,Fint:string;
fnote,fnote1,forderno,fZdyFlag,ViewFlag,fHelpType:Boolean;
PPSTE:integer;
procedure initimage();
procedure initimageSH();
{ Public declarations }
end;
var
frmBPZDY_LRSHK_BF: TfrmBPZDY_LRSHK_BF;
Mach: array of TfrmSLT_PBSK;
Mach1: array of TfrmSlt;
implementation
uses
U_DataLink,U_Fun10,U_BPZdy_SH, U_BPZdy_HXK,U_CPTypePB,U_FileUp_TP,U_FileUp,U_FileUp_PB,U_FileUp_TPSH,U_SLT_BF1;
{$R *.dfm}
procedure TfrmBPZDY_LRSHK_BF.initTree();
begin
with ADOQueryTree do
begin
Close;
SQL.Clear;
SQL.Add('select *');
sql.Add(', Case when isnull(CPNo,'''')<>'''' then RTrim(CPNo)+''/''+CPName else CPName end as CP ');
SQL.Add('from CP_TypePB order by CPlevel,CPOrder,CPName');
Open;
end;
SCreateCDS20(ADOQueryTree,Order_Tree);
SInitCDSData20(ADOQueryTree,Order_Tree);
cxDBTreeList1.Items[0].Expand(true);
end;
procedure TfrmBPZDY_LRSHK_BF.initimage();
var
i,j:integer;
jpg:TJpegImage;
myStream: TADOBlobStream;
begin
j:=length(Mach);
if j>0 then
begin
for i:=0 to j-1 do
begin
Mach[i].free;
end;
//Finalize(Mach);
end;
SetLength(Mach, 0);
IF ClientDataSet1.IsEmpty then exit;
try
with adoqueryPicture do
begin
close;
sql.Clear;
sql.Add(' select A.TFID,A.WBID,B.XFID,A.FilesOther,B.FileName,C.* from BP_ZDY C ');
sql.Add(' inner join XD_File_TP B on C.SKID =B.SKID');
SQL.Add(' inner join TP_File_TP A on B.CYID=A.WBID ');
sql.Add(' where C.BPID='+quotedstr(trim(ClientDataSet1.fieldbyname('BPID').AsString)));
//ShowMessage(sql.Text);
open;
end;
j:=adoqueryPicture.RecordCount;
if j<1 then exit;
adoqueryPicture.DisableControls;
adoqueryPicture.First;
SetLength(Mach, j);
with adoqueryPicture do
begin
First;
i:=0;
while not eof do
begin
if triM(adoqueryPicture.fieldbyname('TFID').AsString)<>'' then
begin
jpg:=TJpegImage.Create();
myStream:=tadoblobstream.Create(tblobfield(adoqueryPicture.fieldbyname('FilesOther')),bmread);
jpg.LoadFromStream(myStream);
end;
Mach[i] := TfrmSLT_PBSK.Create(Self);
Mach[i].Name:=trim(adoqueryPicture.fieldbyname('XFID').AsString);
Mach[i].Parent := ScrollBox1;
Mach[I].Left:=0+410*i;
if triM(adoqueryPicture.fieldbyname('TFID').AsString)<>'' then
begin
Mach[i].Init(adoqueryPicture.fieldbyname('TFID').AsString,adoqueryPicture.fieldbyname('FileName').AsString,jpg);
end;
i:=i+1;
Next;
end;
end;
adoqueryPicture.EnableControls;
finally
jpg.free;
//application.ProcessMessages;
end;
end;
procedure TfrmBPZDY_LRSHK_BF.initimageSH();
var
i,j,p,x:integer;
jpg:TJpegImage;
myStream: TADOBlobStream;
FZGao:string;
begin
j:=length(Mach1);
if j>0 then
begin
for i:=0 to j-1 do
begin
Mach1[i].free;
end;
//Finalize(Mach1);
end;
SetLength(Mach1, 0);
IF ClientDataSet1.IsEmpty then exit;
try
with adoqueryPicture do
begin
close;
sql.Clear;
sql.Add(' select A.TFID,A.WBID,A.FilesOther,B.FileName,C.*,D.* from BP_ZDY C ');
sql.Add(' inner join XD_File B on C.SKID =B.SKID');
SQL.Add(' inner join TP_File A on B.XFID=A.TFID ');
sql.Add(' left join SH_Base D on A.WBID=D.WBID ');
sql.Add(' where C.BPID='+quotedstr(trim(ClientDataSet1.fieldbyname('BPID').AsString)));
sql.Add(' order by D.ColorNo');
//ShowMessage(sql.Text);
open;
end;
j:=adoqueryPicture.RecordCount;
if j<1 then exit;
adoqueryPicture.DisableControls;
adoqueryPicture.First;
SetLength(Mach1, j);
with adoqueryPicture do
begin
First;
i:=0;
x:=0;
p:=0;
while not eof do
begin
jpg:=TJpegImage.Create();
myStream:=tadoblobstream.Create(tblobfield(adoqueryPicture.fieldbyname('FilesOther')),bmread);
jpg.LoadFromStream(myStream);
if i<3*(p+1) then
begin
end
else
begin
p:=p+1;
end;
Mach1[i] := TfrmSLT.Create(Self);
Mach1[i].Name:=trim(adoqueryPicture.fieldbyname('TFID').AsString);
Mach1[i].Parent := ScrollBox2;
Mach1[I].Left:=0+(x-3*p)*185;
Mach1[I].Top:=p*143;
if adoqueryPicture.fieldbyname('SHID').AsString='' then
begin
Mach1[I].ColorNo.Text:=inttostr(i+1);
Mach1[i].WBID.Text:=trim(adoqueryPicture.fieldbyname('WBID').AsString);
end
else
begin
SCSHDataNew(adoqueryPicture,Mach1[I].Panel1,2);
end;
Mach1[I].SH.Caption:=Trim(adoqueryPicture.fieldbyname('ColorNo').AsString);
Mach1[I].ZW.Caption:=Trim(adoqueryPicture.fieldbyname('ColorName').AsString);
Mach1[I].YW.Caption:=Trim(adoqueryPicture.fieldbyname('ColorNameEng').AsString);
if triM(adoqueryPicture.fieldbyname('TFID').AsString)<>'' then
begin
Mach1[i].Init(adoqueryPicture.fieldbyname('TFID').AsString,adoqueryPicture.fieldbyname('FileName').AsString,jpg);
end;
i:=i+1;
x:=x+1;
Next;
end;
end;
adoqueryPicture.EnableControls;
finally
jpg.free;
//application.ProcessMessages;
end;
end;
procedure TfrmBPZDY_LRSHK_BF.SaveData();
var maxno:string;
begin
if FGYName<>'' then exit;
try
ADOQueryCmd.Connection.BeginTrans;
ClientDataSet1.DisableControls;
with ClientDataSet1 do
begin
First;
while not eof do
begin
if Trim(ClientDataSet1.FieldByName('BPID').AsString)='' then
begin
if GetLSNo(ADOQueryTemp,maxno,'BP','BP_ZDY',3,1)=False then
begin
ADOQueryCmd.Connection.RollbackTrans;
ClientDataSet1.EnableControls;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end
else
begin
maxno:=Trim(ClientDataSet1.fieldbyname('BPID').AsString);
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from BP_ZDY where BPID='''+Trim(maxno)+'''');
Open;
end;
if ADOQueryCmd.IsEmpty then
begin
ADOQueryCmd.Append;
end
else
begin
ADOQueryCmd.Edit;
end;
ADOQueryCmd.FieldByName('BPID').Value:=Trim(maxno);
SSetSaveDataCDSNew(ADOQueryCmd,Tv1,ClientDataSet1,'BP_ZDY',3);
ADOQueryCmd.FieldByName('BPType').Value:=flagName;
ADOQueryCmd.FieldByName('BPFlag').Value:=flag;
ADOQueryCmd.FieldByName('valid').Value:='Y';
ADOQueryCmd.Post;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.add('select * from BP_ZDY where BPCode='''+Trim(ClientDataSet1.fieldbyname('BPCode').AsString)+'''');
sql.Add(' and BPFlag='''+trim(flag)+'''');
Open;
end;
if ADOQueryTemp.IsEmpty=False then
begin
if ADOQueryTemp.RecordCount>1 then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add('delete BP_ZDY where BPID='''+Trim(ClientDataSet1.fieldbyname('BPID').AsString)+'''');
ExecSQL;
end;
ADOQueryCmd.Connection.RollbackTrans;
ClientDataSet1.EnableControls;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>','<27><>ʾ',0);
Exit;
end;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.add('select * from BP_ZDY where BPName='''+Trim(ClientDataSet1.fieldbyname('BPName').AsString)+'''');
sql.add(' and isnull(BPMF,'''')='''+Trim(ClientDataSet1.fieldbyname('BPMF').AsString)+'''');
sql.add(' and isnull(BPKZ,'''')='''+Trim(ClientDataSet1.fieldbyname('BPKZ').AsString)+'''');
sql.add(' and isnull(BPJS,'''')='''+Trim(ClientDataSet1.fieldbyname('BPJS').AsString)+'''');
sql.add(' and isnull(BPWS,'''')='''+Trim(ClientDataSet1.fieldbyname('BPWS').AsString)+'''');
sql.add(' and isnull(BPMiDu,'''')='''+Trim(ClientDataSet1.fieldbyname('BPMiDu').AsString)+'''');
sql.add(' and isnull(BPUnit,'''')='''+Trim(ClientDataSet1.fieldbyname('BPUnit').AsString)+'''');
sql.Add(' and BPFlag='''+trim(flag)+'''');
Open;
end;
if ADOQueryTemp.IsEmpty=False then
begin
if ADOQueryTemp.RecordCount>1 then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add('delete BP_ZDY where BPID='''+Trim(ClientDataSet1.fieldbyname('BPID').AsString)+'''');
ExecSQL;
end;
ADOQueryCmd.Connection.RollbackTrans;
ClientDataSet1.EnableControls;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD>ؾ<EFBFBD>ɴγɴ<CEB3>ظ<EFBFBD><D8B8><EFBFBD>','<27><>ʾ',0);
Exit;
end;
end;
ClientDataSet1.Edit;
ClientDataSet1.FieldByName('BPID').Value:=Trim(maxno);
//ClientDataSet1.Post;
Next;
end;
ClientDataSet1.EnableControls;
end;
TV1.OptionsData.Editing:=false;
TV1.OptionsSelection.CellSelect:=false;
ADOQueryCmd.Connection.CommitTrans;
except;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
end;
end;
procedure TfrmBPZDY_LRSHK_BF.FormCreate(Sender: TObject);
begin
try
//cxGrid1.Align:=alClient;
with ADOConnection1 do
begin
Connected:=false;
ConnectionString:=DConString;
//ConnectionString:='';
Connected:=true;
end;
except;
frmBPZDY_LRSHK_BF.Free;
end;
end;
procedure TfrmBPZDY_LRSHK_BF.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
ToolBar1.SetFocus;
Finalize(Mach1);
Finalize(Mach);
Action:=caFree;
end;
procedure TfrmBPZDY_LRSHK_BF.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Close;
sql.Clear;
sql.Add(' exec P_Select_BP :Code,:PState,:CYType,:Stats ');
Parameters.ParamByName('Code').Value:='';
Parameters.ParamByName('PState').Value:=0;
Parameters.ParamByName('CYType').Value:=Trim(Order_Tree.fieldbyname('CPID').AsString);
Parameters.ParamByName('Stats').Value:='';
Open;
end;
SCreateCDS20(ADOQueryMain,ClientDataSet1);
SInitCDSData20(ADOQueryMain,ClientDataSet1);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmBPZDY_LRSHK_BF.TBSaveClick(Sender: TObject);
var
maxno:string;
begin
if ClientDataSet1.IsEmpty then Exit;
Toolbar1.SetFocus;
if ClientDataSet1.Locate('BPCode',null,[]) then
begin
Application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if ClientDataSet1.Locate('BPCode','',[]) then
begin
Application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if ClientDataSet1.Locate('BPName',null,[]) then
begin
Application.MessageBox('<27><><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if ClientDataSet1.Locate('BPName','',[]) then
begin
Application.MessageBox('<27><><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
SaveData();
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
end;
procedure TfrmBPZDY_LRSHK_BF.TBCloseClick(Sender: TObject);
begin
ToolBar1.SetFocus;
WriteCxGrid('<27>Զ<EFBFBD><D4B6><EFBFBD>'+Trim(flag)+'101',TV1,'<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Close;
end;
procedure TfrmBPZDY_LRSHK_BF.FormShow(Sender: TObject);
begin
initTree();
InitGrid();
ReadCxGrid('<27>Զ<EFBFBD><D4B6><EFBFBD>'+Trim(flag)+'101',TV1,'<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
frmBPZDY_LRSHK_BF.Caption:=Trim(flagname);
end;
procedure TfrmBPZDY_LRSHK_BF.BPNamehange(Sender: TObject);
var
fsj:String;
begin
if Trim(BPNameM.Text)<>'' then
begin
fsj:=' BPName like '''+'%'+Trim(BPNameM.Text)+'%'+'''';
end;
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain,fsj);
SCreateCDS20(ADOQueryMain,ClientDataSet1);
SInitCDSData20(ADOQueryMain,ClientDataSet1);
end;
end;
procedure TfrmBPZDY_LRSHK_BF.V1NotePropertiesEditValueChanged(Sender: TObject);
var
mvalue:string;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
with ClientDataSet1 do
begin
Edit;
FieldByName('BPKZ').Value:=mvalue;
//Post;
end;
end;
procedure TfrmBPZDY_LRSHK_BF.V1HelpTypePropertiesEditValueChanged(
Sender: TObject);
var
mvalue:string;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
with ClientDataSet1 do
begin
Edit;
FieldByName('BPWS').Value:=mvalue;
Post;
end;
{with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('Update KH_Zdy Set HelpType='''+Trim(mvalue)+'''');
sql.Add(' where ZdyNo='''+Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)+'''');
ExecSQL;
end;}
end;
procedure TfrmBPZDY_LRSHK_BF.v1note1PropertiesEditValueChanged(Sender: TObject);
var
mvalue:string;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
with ClientDataSet1 do
begin
Edit;
FieldByName('BPMiDu').Value:=mvalue;
Post;
end;
end;
procedure TfrmBPZDY_LRSHK_BF.V1BPCodePropertiesEditValueChanged(Sender: TObject);
var
mvalue:string;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
with ClientDataSet1 do
begin
Edit;
FieldByName('BPCode').Value:=mvalue;
end;
{with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('Update BP_ZDY Set BPCode='''+Trim(mvalue)+'''');
sql.Add(' where BPID='''+Trim(ClientDataSet1.fieldbyname('BPID').AsString)+'''');
ExecSQL;
end;}
end;
procedure TfrmBPZDY_LRSHK_BF.V1BPNamePropertiesEditValueChanged(Sender: TObject);
var
mvalue:string;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
with ClientDataSet1 do
begin
Edit;
FieldByName('BPName').Value:=mvalue;
end;
end;
procedure TfrmBPZDY_LRSHK_BF.ToolButton4Click(Sender: TObject);
begin
ToolBar1.SetFocus;
if ClientDataSet1.IsEmpty then exit;
if ClientDataSet1.FieldByName('BPID').AsString='' then
begin
application.MessageBox('<27><EFBFBD><EBB1A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ','<27><>ʾ');
exit;
end;
with ML_GYS do
begin
Append;
post;
end;
end;
procedure TfrmBPZDY_LRSHK_BF.ToolButton5Click(Sender: TObject);
begin
ToolBar1.SetFocus;
if ML_GYS.IsEmpty then Exit;
if Trim(ML_GYS.FieldByName('BPSubID').AsString)<>'' then
begin
if application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD>?','<27><>ʾ<EFBFBD><CABE>Ϣ',1)=2 then exit;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete BP_ZDY_Sub where BPSubID='''+Trim(ML_GYS.fieldbyname('BPSubID').AsString)+'''');
ExecSQL;
end;
end;
ML_GYS.Delete;
end;
procedure TfrmBPZDY_LRSHK_BF.BPCodeMChange(Sender: TObject);
var
fsj:String;
begin
if Trim(BPCodeM.Text)<>'' then
begin
fsj:=' BPCode like '''+'%'+Trim(BPCodeM.Text)+'%'+'''';
end;
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain,fsj);
SCreateCDS20(ADOQueryMain,ClientDataSet1);
SInitCDSData20(ADOQueryMain,ClientDataSet1);
end;
end;
procedure TfrmBPZDY_LRSHK_BF.Tv3CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
var i:Integer;
begin
if ML_GX.IsEmpty then exit;
ML_GX.Delete;
i:=1;
ML_GX.DisableControls;
with ML_GX do
begin
first;
while not eof do
begin
Edit;
FieldByName('BPMiDu').Value:=i;
i:=i+1;
next;
end;
end;
ML_GX.EnableControls;
end;
procedure TfrmBPZDY_LRSHK_BF.TPBLBClick(Sender: TObject);
begin
frmCPTypePB:=TfrmCPTypePB.Create(self);
with frmCPTypePB do
begin
if ShowModal=1 then
begin
end;
free;
end;
initTree();
end;
procedure TfrmBPZDY_LRSHK_BF.ToolButton1Click(Sender: TObject);
var
maxno:string;
j,i:Integer;
begin
ToolBar1.SetFocus;
with ScrollBox2 do
begin
for i:=0 to ScrollBox2.ControlCount-1 do
begin
if Controls[i] is TfrmSLT then
begin
with TfrmSLT(Controls[i]).Panel1 do
begin
for j:=0 to ControlCount-1 do
begin
if Controls[j] is TButton then
begin
TButton(Controls[j]).Click;
end;
end;
end;
end;
end;
end;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>','<27><>ʾ');
initimageSH();
end;
procedure TfrmBPZDY_LRSHK_BF.cxDBTreeList1Click(Sender: TObject);
begin
InitGrid();
if Order_Tree.FieldByName('CPLevel').AsInteger<3 then
begin
end else
begin
//Panel5.Visible:=True;
//SClearData(Panel5,2);
// BPMF.Text:='160';
//BPCF.Text:='100%P';
// Button1.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
FBPID:='';
FCPID:=Trim(Order_Tree.fieldbyname('CPID').AsString);
FCPNo:=Trim(Order_Tree.fieldbyname('CPNo').AsString);
FCPName:=Trim(Order_Tree.fieldbyname('CPName').AsString);
end;
end;
procedure TfrmBPZDY_LRSHK_BF.TSHClick(Sender: TObject);
begin
try
frmFileUp_TPSH:=TfrmFileUp_TPSH.Create(Application);
with frmFileUp_TPSH do
begin
if Self.ClientDataSet1.fieldbyname('SKID').AsString='' then
begin
Code.Text:=Trim(Self.ClientDataSet1.fieldbyname('BPCode').AsString); //ɫ<><C9AB><EFBFBD><EFBFBD>SKID
CYID:=Trim(Self.ClientDataSet1.fieldbyname('BPCode').AsString);
FSKID:=Trim(Self.ClientDataSet1.fieldbyname('BPCode').AsString);
end
else
begin
Code.Text:=Trim(Self.ClientDataSet1.fieldbyname('SKID').AsString); //ɫ<><C9AB><EFBFBD><EFBFBD>SKID
CYID:=Trim(Self.ClientDataSet1.fieldbyname('SKID').AsString);
FSKID:=Trim(Self.ClientDataSet1.fieldbyname('SKID').AsString);
end;
if ShowModal=1 then
begin
if Self.ClientDataSet1.fieldbyname('SKID').AsString='' then
begin
with ADOQuery6 do
begin
Close;
sql.Clear;
sql.Add('update BP_ZDY set SKID='''+Trim(Self.ClientDataSet1.fieldbyname('BPCode').AsString)+''' ');
sql.Add('where BPID='''+Trim(ClientDataSet1.fieldbyname('BPID').AsString)+'''');
execsql;
end;
with Self.ClientDataSet1 do
begin
edit;
FieldByName('SKID').Value:=Trim(fieldbyname('BPCode').AsString);
end;
end
else
begin
with ADOQuery6 do
begin
Close;
sql.Clear;
sql.Add('update BP_ZDY set SKID='''+Trim(Self.ClientDataSet1.fieldbyname('SKID').AsString)+''' ');
sql.Add('where BPID='''+Trim(ClientDataSet1.fieldbyname('BPID').AsString)+'''');
execsql;
end;
with Self.ClientDataSet1 do
begin
edit;
FieldByName('SKID').Value:=Trim(fieldbyname('SKID').AsString);
end;
end;
end;
end;
finally
frmFileUp_TPSH.Free;
end;
initimageSH();
end;
procedure TfrmBPZDY_LRSHK_BF.TV1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
initimage();
initimageSH();
end;
procedure TfrmBPZDY_LRSHK_BF.Button1Click(Sender: TObject);
begin
try
frmFileUp_PB:=TfrmFileUp_PB.Create(Application);
with frmFileUp_PB do
begin
if Self.ClientDataSet1.fieldbyname('SKID').AsString='' then
begin
Code.Text:=Trim(Self.ClientDataSet1.fieldbyname('BPCode').AsString);
FSKID:=Trim(Self.ClientDataSet1.fieldbyname('BPCode').AsString);
end
else
begin
Code.Text:=Trim(Self.ClientDataSet1.fieldbyname('SKID').AsString);
FSKID:=Trim(Self.ClientDataSet1.fieldbyname('SKID').AsString);
end;
if ShowModal=1 then
begin
if Self.ClientDataSet1.fieldbyname('SKID').AsString='' then
begin
with ADOQuery6 do
begin
Close;
sql.Clear;
sql.Add('update BP_ZDY set SKID='''+Trim(Self.ClientDataSet1.fieldbyname('BPCode').AsString)+''' ');
sql.Add('where BPID='''+Trim(ClientDataSet1.fieldbyname('BPID').AsString)+'''');
execsql;
end;
with Self.ClientDataSet1 do
begin
edit;
FieldByName('SKID').Value:=Trim(fieldbyname('BPCode').AsString);
end;
end
else
begin
with ADOQuery6 do
begin
Close;
sql.Clear;
sql.Add('update BP_ZDY set SKID='''+Trim(Self.ClientDataSet1.fieldbyname('SKID').AsString)+''' ');
sql.Add('where BPID='''+Trim(ClientDataSet1.fieldbyname('SKID').AsString)+'''');
execsql;
end;
with Self.ClientDataSet1 do
begin
edit;
FieldByName('SKID').Value:=Trim(fieldbyname('SKID').AsString);
end;
end;
end;
end;
finally;
frmFileUp_PB.Free;
end;
initimage();
end;
procedure TfrmBPZDY_LRSHK_BF.THBClick(Sender: TObject);
var SSKID:string;
begin
if ClientDataSet1.IsEmpty then Exit;
if ClientDataSet1.Locate('Ssel',true,[])=false then
begin
application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ');
exit;
end;
if Application.MessageBox(<><C8B7>Ҫ<EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD>','<27><>ʾ',1)=2 then exit;
ClientDataSet1.DisableControls;
with ClientDataSet1 do
begin
First;
while not eof do
begin
if FieldByName('Ssel').AsBoolean=true then
begin
if fieldbyname('SKID').AsString<>'' then
begin
if SSKID='' then
begin
SSKID:=Trim(fieldbyname('SKID').AsString);
end
else
begin
if SSKID<>Trim(fieldbyname('SKID').AsString) then
begin
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>ܺϲ<DCBA>','<27><>ʾ');
ClientDataSet1.EnableControls;
Exit;
end;
end;
end;
end;
next;
end;
end;
ClientDataSet1.EnableControls;
if SSKID='' then
begin
application.MessageBox('<27><>ѡ<EFBFBD><D1A1>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ϊ<EFBFBD>յ<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ');
Exit;
end;
ClientDataSet1.DisableControls;
with ClientDataSet1 do
begin
First;
while not eof do
begin
if FieldByName('Ssel').AsBoolean=true then
begin
with ADOQuery6 do
begin
close;
sql.Clear;
sql.Add('update BP_ZDY set SKID='''+trim(SSKID)+''' ');
sql.Add('where BPID='''+trim(ClientDataSet1.fieldbyname('BPID').AsString)+'''');
ExecSQL;
end;
edit;
FieldByName('SKID').Value:=Trim(SSKID);
end;
next;
end;
end;
ClientDataSet1.EnableControls;
end;
procedure TfrmBPZDY_LRSHK_BF.TCFClick(Sender: TObject);
begin
if ClientDataSet1.IsEmpty then Exit;
if ClientDataSet1.Locate('Ssel',true,[])=false then
begin
application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ');
exit;
end;
if Application.MessageBox(<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',1)=2 then exit;
ClientDataSet1.DisableControls;
with ClientDataSet1 do
begin
First;
while not eof do
begin
if FieldByName('Ssel').AsBoolean=true then
begin
with ADOQuery6 do
begin
close;
sql.Clear;
sql.Add('update BP_ZDY set SKID='''' ');
sql.Add('where BPID='''+trim(ClientDataSet1.fieldbyname('BPID').AsString)+'''');
ExecSQL;
end;
edit;
FieldByName('SKID').Value:='';
end;
next;
end;
end;
ClientDataSet1.EnableControls;
end;
end.