D10myBiaoqi/A09财务通用管理/U_BatchEditUnit.pas
2026-05-19 17:05:02 +08:00

96 lines
2.0 KiB
ObjectPascal
Raw Permalink 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_BatchEditUnit;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cxGraphics,
cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxContainer, cxEdit,
Vcl.Menus, Vcl.StdCtrls, cxButtons, cxLabel, cxTextEdit, cxMaskEdit,
cxDropDownEdit, dxSkinsCore, dxSkinWXI, Data.DB, Data.Win.ADODB, U_BaseInput;
type
TfrmBatchEditUnit = class(TfrmBaseInput)
btnOK: TcxButton;
btnCancel: TcxButton;
cxLabel2: TcxLabel;
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
QtyUnit: TcxComboBox;
procedure btnCancelClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure btnOKClick(Sender: TObject);
private
{ Private declarations }
public
FDRSIDList: string;
Fflag: Integer;
{ Public declarations }
end;
var
frmBatchEditUnit: TfrmBatchEditUnit;
implementation
uses
U_DataLink;
{$R *.dfm}
procedure TfrmBatchEditUnit.btnCancelClick(Sender: TObject);
begin
close;
end;
procedure TfrmBatchEditUnit.btnOKClick(Sender: TObject);
begin
inherited;
if Trim(QtyUnit.Text) = '' then
begin
Application.MessageBox('请输入单位', '提示信息', 0);
Exit;
end;
if FDRSIDList = '' then
Exit;
// 只允许 Tab=2 的情况(更新 Trade_Cloth_DR_Sub 的 QtyUnit
if Fflag = 2 then
begin
try
with ADOQuery1 do
begin
Close;
SQL.Clear;
SQL.Add('update Trade_Cloth_DR_Sub set QtyUnit = ' + QuotedStr(QtyUnit.Text) +
' where DRSID in (' + FDRSIDList + ')');
ExecSQL;
end;
finally
ModalResult := mrOk;
end;
end;
end;
procedure TfrmBatchEditUnit.FormShow(Sender: TObject);
begin
try
with ADOConnection1 do
begin
if not Connected then
begin
Connected := false;
ConnectionString := DConString;
LoginPrompt := false;
Connected := true;
end;
end;
except
application.MessageBox('数据库连接失败!', '错误', mb_Ok + MB_ICONERROR);
end;
end;
end.