RTFormwork/public10/design/U_BaseOneTableInput.pas
2024-10-23 13:26:30 +08:00

147 lines
3.9 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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;
TgridSet: TToolButton;
procedure TBCloseClick(Sender: TObject);
procedure TsjClick(Sender: TObject);
procedure TBSaveClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure dxLayoutControl_inputDblClick(Sender: TObject);
private
fWindowDesign:TWindowFormdesign;
fDesignCode:string;
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
saveLayOut(application,dxLayoutControl_input, ADOQueryBaseCmd,
PWideChar( fDllFileName + '|' + SELF.Name + '|' + dxLayoutControl_input.Name+ '.ini'));
end;
procedure TfrmBaseOneTableInput.dxLayoutControl_inputDblClick(Sender: TObject);
begin
layoutDesign(TdxLayoutControl(Sender),ADOQueryBaseCmd,PWideChar(dcode));
end;
procedure TfrmBaseOneTableInput.FormCreate(Sender: TObject);
begin
fWindowDesign:=TWindowFormDeSign.Create();
end;
procedure TfrmBaseOneTableInput.FormDestroy(Sender: TObject);
begin
fWindowDesign.free;
end;
procedure TfrmBaseOneTableInput.FormShow(Sender: TObject);
begin
tGridSet.Visible:=gIsCanDesign;
fWindowDesign.FormStyleInit10(self,0,ADOQueryBaseTemp,ADOQueryBaseCmd) ;
Tsj.Visible:=gIsCanDesign;
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.