248 lines
5.9 KiB
ObjectPascal
248 lines
5.9 KiB
ObjectPascal
unit U_ZdyAttInputCP_other;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, ExtCtrls, cxPC, cxControls, ComCtrls, ToolWin, StdCtrls, Menus,
|
||
cxTextEdit, cxCurrencyEdit, BtnEdit, cxContainer, cxEdit, cxImage, DB,
|
||
ADODB, cxDBEdit, cxLookAndFeelPainters, cxButtons,strUtils;
|
||
|
||
type
|
||
TfrmZdyAttInputCP_other = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
ToolButton3: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
GroupBox1: TGroupBox;
|
||
Label1: TLabel;
|
||
zdyCode: TEdit;
|
||
Label2: TLabel;
|
||
zdyName: TEdit;
|
||
Label3: TLabel;
|
||
defNote3: TEdit;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
Label7: TLabel;
|
||
Label11: TLabel;
|
||
DEFstr3: TEdit;
|
||
DEFstr6: TEdit;
|
||
Note: TMemo;
|
||
Label13: TLabel;
|
||
Label17: TLabel;
|
||
DEFFlt1: TcxCurrencyEdit;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
N3: TMenuItem;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryTmp: TADOQuery;
|
||
ADOQueryImage: TADOQuery;
|
||
ADOQuerymain: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
Picture4: TcxDBImage;
|
||
FileName: TcxButton;
|
||
DEFFlt3: TcxCurrencyEdit;
|
||
Label6: TLabel;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure FileNameClick(Sender: TObject);
|
||
procedure DEFstr3Exit(Sender: TObject);
|
||
procedure zdyNameExit(Sender: TObject);
|
||
private
|
||
function savedata():Boolean;
|
||
procedure InitGrid();
|
||
procedure InitImage();
|
||
{ Private declarations }
|
||
public
|
||
FCYID:string;
|
||
fFlileFlag:string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmZdyAttInputCP_other: TfrmZdyAttInputCP_other;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_Fun10,U_ZDYHelp, getpic;
|
||
{$R *.dfm}
|
||
procedure TfrmZdyAttInputCP_other.InitImage();
|
||
begin
|
||
with ADOQueryImage do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from TP_File A');
|
||
sql.Add('where WBID='+quotedstr(trim(FCYID)));
|
||
open;
|
||
end;
|
||
end;
|
||
function TfrmZdyAttInputCP_other.savedata():Boolean;
|
||
begin
|
||
result:=false;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from KH_Zdy_Attachment where ATID='''+Trim(FCYID)+'''');
|
||
Open;
|
||
If IsEmpty then
|
||
begin
|
||
append;
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('Edittime').Value:=SGetServerDateTime(ADOQueryTmp);
|
||
end;
|
||
SSetsaveSqlNew(ADOQueryCmd,'KH_Zdy_Attachment',GroupBox1,2);
|
||
FieldByName('ATID').Value:=Trim(FCYID);
|
||
FieldByName('DEFFlt3').Value:=strtofloatdef(DEFFlt3.Text,0);
|
||
FieldByName('Type').Value:='CP';
|
||
post;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Zdy_Attachment where ZdyName='''+Trim(zdyName.Text)+''' and DEFstr3='''+Trim(DEFstr3.Text)+''' ');
|
||
sql.Add(' and Type=''CP'' ');
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.RecordCount>1 then
|
||
begin
|
||
// ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
|
||
result:=true;
|
||
except
|
||
end;
|
||
end;
|
||
procedure TfrmZdyAttInputCP_other.InitGrid();
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Zdy_Attachment A');
|
||
sql.Add('where ATID='+quotedstr(trim(FCYID)));
|
||
open;
|
||
end;
|
||
IF not ADOQueryMain.IsEmpty then
|
||
begin
|
||
SCSHDataNew(ADOQueryMain,GroupBox1,2);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputCP_other.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmZdyAttInputCP_other:=nil;
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputCP_other.TBCloseClick(Sender: TObject);
|
||
begin
|
||
close;
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputCP_other.FormCreate(Sender: TObject);
|
||
begin
|
||
Panel1.Align:=alclient;
|
||
clearControl(GroupBox1,2);
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputCP_other.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
IF trim(zdyCode.Text)='' then
|
||
begin
|
||
application.MessageBox('<27><>ƷID<49><44><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
IF trim(zdyName.Text)='' then
|
||
begin
|
||
application.MessageBox('<27><>Ʒ<EFBFBD><C6B7><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
IF trim(DEFstr3.Text)='' then
|
||
begin
|
||
application.MessageBox('<27><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
IF rightBStr(trim(zdyName.Text),1)<>'#' then
|
||
zdyName.Text:=trim(zdyName.Text)+'#';
|
||
IF rightBStr(trim(defstr3.Text),1)<>'#' then
|
||
defstr3.Text:=trim(defstr3.Text)+'#';
|
||
|
||
AdoqueryCmd.Connection.BeginTrans;
|
||
try
|
||
IF not savedata() then
|
||
begin
|
||
AdoqueryCmd.Connection.RollbackTrans;
|
||
exit;
|
||
end;
|
||
AdoqueryCmd.Connection.CommitTrans;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
self.ModalResult:=1;
|
||
except
|
||
AdoqueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONERROR);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputCP_other.FormShow(Sender: TObject);
|
||
begin
|
||
|
||
IF FCYID='' then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd,FCYID,'CP','KH_Zdy_Attachment',4,1)=False then
|
||
begin
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
zdyCode.Text:=trim(FCYID);
|
||
end;
|
||
initGrid();
|
||
InitImage();
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputCP_other.FileNameClick(Sender: TObject);
|
||
begin
|
||
FormGetPic:=TFormGetPic.create(self);
|
||
with FormGetPic do
|
||
begin
|
||
fFlileFlag:=self.fFlileFlag;
|
||
fkeyNo:=trim(zdyCode.Text);
|
||
pat1:='FileName';
|
||
pic1:='FilesOther';
|
||
FTFType:='HX';
|
||
If showmodal=1 then
|
||
begin
|
||
end;
|
||
free;
|
||
end;
|
||
Initimage();
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputCP_other.DEFstr3Exit(Sender: TObject);
|
||
begin
|
||
IF rightBStr(trim(defstr3.Text),1)<>'#' then
|
||
defstr3.Text:=trim(defstr3.Text)+'#';
|
||
end;
|
||
|
||
procedure TfrmZdyAttInputCP_other.zdyNameExit(Sender: TObject);
|
||
begin
|
||
IF rightBStr(trim(zdyName.Text),1)<>'#' then
|
||
zdyName.Text:=trim(zdyName.Text)+'#';
|
||
end;
|
||
|
||
end.
|