2024-10-12 10:45:24 +08:00
|
|
|
|
unit U_BaseOneTableInput;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
|
|
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.ToolWin, cxGraphics,
|
|
|
|
|
cxControls, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore,
|
|
|
|
|
dxSkinsDefaultPainters, dxSkinWXI, cxClasses, dxLayoutContainer,
|
|
|
|
|
dxLayoutControl, Data.DB, Data.Win.ADODB,U_WindowFormdesign;
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
TfrmBaseOneTableInput = class(TForm)
|
|
|
|
|
ToolBar1: TToolBar;
|
|
|
|
|
TBSave: TToolButton;
|
|
|
|
|
Tsj: TToolButton;
|
|
|
|
|
TBClose: TToolButton;
|
|
|
|
|
dxLayoutControl_inputGroup_Root: TdxLayoutGroup;
|
|
|
|
|
dxLayoutControl_input: TdxLayoutControl;
|
|
|
|
|
ADOQueryBaseCmd: TADOQuery;
|
|
|
|
|
ADOQueryBaseTemp: TADOQuery;
|
2024-10-23 13:26:30 +08:00
|
|
|
|
TgridSet: TToolButton;
|
2024-10-12 10:45:24 +08:00
|
|
|
|
procedure TBCloseClick(Sender: TObject);
|
|
|
|
|
procedure TsjClick(Sender: TObject);
|
|
|
|
|
procedure TBSaveClick(Sender: TObject);
|
|
|
|
|
procedure FormCreate(Sender: TObject);
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
procedure FormDestroy(Sender: TObject);
|
2024-10-23 13:26:30 +08:00
|
|
|
|
procedure dxLayoutControl_inputDblClick(Sender: TObject);
|
2024-10-12 10:45:24 +08:00
|
|
|
|
private
|
|
|
|
|
fWindowDesign:TWindowFormdesign;
|
2024-10-23 13:26:30 +08:00
|
|
|
|
fDesignCode:string;
|
2024-10-12 10:45:24 +08:00
|
|
|
|
function SaveData(): Boolean;
|
|
|
|
|
public
|
|
|
|
|
fKeyNo:string;
|
|
|
|
|
fTabelName:string;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
frmBaseOneTableInput: TfrmBaseOneTableInput;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
uses
|
|
|
|
|
U_RTFun ,U_globalVar,U_dataLink,U_FormLayOutDesign;
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
procedure TfrmBaseOneTableInput.TBCloseClick(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
close;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmBaseOneTableInput.TBSaveClick(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
if not mustInCheck(application, dxLayoutControl_input,PWideChar('*')) then
|
|
|
|
|
exit;
|
|
|
|
|
if SaveData() then
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmBaseOneTableInput.TsjClick(Sender: TObject);
|
|
|
|
|
begin
|
2024-10-23 13:26:30 +08:00
|
|
|
|
saveLayOut(application,dxLayoutControl_input, ADOQueryBaseCmd,
|
2024-10-12 10:45:24 +08:00
|
|
|
|
PWideChar( fDllFileName + '|' + SELF.Name + '|' + dxLayoutControl_input.Name+ '.ini'));
|
|
|
|
|
end;
|
|
|
|
|
|
2024-10-23 13:26:30 +08:00
|
|
|
|
procedure TfrmBaseOneTableInput.dxLayoutControl_inputDblClick(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
layoutDesign(TdxLayoutControl(Sender),ADOQueryBaseCmd,PWideChar(dcode));
|
|
|
|
|
end;
|
|
|
|
|
|
2024-10-12 10:45:24 +08:00
|
|
|
|
procedure TfrmBaseOneTableInput.FormCreate(Sender: TObject);
|
2024-10-30 13:45:23 +08:00
|
|
|
|
var
|
|
|
|
|
mFontSize:integer;
|
2024-10-12 10:45:24 +08:00
|
|
|
|
begin
|
2024-10-30 13:45:23 +08:00
|
|
|
|
getSystemIni();
|
|
|
|
|
if gFontSize<9 then
|
|
|
|
|
begin
|
|
|
|
|
mFontSize := 12;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
mFontSize:=gFontSize ;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
self.Font.Size := gFontSize;
|
|
|
|
|
if trim(gFontName)<>'' then
|
|
|
|
|
self.Font.Name:=gFontName;
|
2024-10-12 10:45:24 +08:00
|
|
|
|
fWindowDesign:=TWindowFormDeSign.Create();
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmBaseOneTableInput.FormDestroy(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
fWindowDesign.free;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TfrmBaseOneTableInput.FormShow(Sender: TObject);
|
|
|
|
|
begin
|
2024-10-23 13:26:30 +08:00
|
|
|
|
tGridSet.Visible:=gIsCanDesign;
|
|
|
|
|
fWindowDesign.FormStyleInit10(self,0,ADOQueryBaseTemp,ADOQueryBaseCmd) ;
|
|
|
|
|
Tsj.Visible:=gIsCanDesign;
|
2024-10-12 10:45:24 +08:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TfrmBaseOneTableInput.SaveData(): Boolean;
|
|
|
|
|
var
|
|
|
|
|
maxno, Smaxno, maxorderno, MaxFNo: string;
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
result := false;
|
|
|
|
|
ADOQueryBaseCmd.Connection.BeginTrans;
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if trim(fKeyNo) = '' then
|
|
|
|
|
begin
|
|
|
|
|
if GetLSNo(ADOQueryBaseCmd, maxno, '', fTabelName, 3, 1) = false then
|
|
|
|
|
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!');
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
maxno := trim(fKeyNo);
|
|
|
|
|
end;
|
|
|
|
|
with ADOQueryBaseCmd do
|
|
|
|
|
begin
|
|
|
|
|
close;
|
|
|
|
|
sql.Clear;
|
|
|
|
|
sql.Add('select * from '+fTabelName);
|
|
|
|
|
sql.Add('where recid=' +quotedstr(trim(fKeyNo)));
|
|
|
|
|
end;
|
|
|
|
|
with ADOQueryBaseCmd do
|
|
|
|
|
begin
|
|
|
|
|
if IsEmpty then
|
|
|
|
|
begin
|
|
|
|
|
Append;
|
|
|
|
|
fieldbyname('FillId').Value := trim(DCode);
|
|
|
|
|
fieldbyname('Filler').Value := trim(DName);
|
|
|
|
|
fieldbyname('status').Value := '0';
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
Edit;
|
|
|
|
|
fieldbyname('EditId').Value := trim(DCode);
|
|
|
|
|
fieldbyname('Editer').Value := trim(DName);
|
|
|
|
|
fieldbyname('EditTime').Value := SGetServerDateTime(ADOQueryBaseTemp);
|
|
|
|
|
end;
|
|
|
|
|
LRTSetsavedata(ADOQueryBaseCmd, fTabelName, dxLayoutControl_input, 2);
|
|
|
|
|
fieldbyname('recid').Value := trim(maxno);
|
|
|
|
|
|
|
|
|
|
Post;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
fkeyNo := trim(maxno);
|
|
|
|
|
ADOQueryBaseCmd.Connection.CommitTrans;
|
|
|
|
|
result := True;
|
|
|
|
|
except
|
|
|
|
|
ADOQueryBaseCmd.Connection.RollbackTrans;
|
|
|
|
|
Application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end.
|