D10myBiaoqi/A09财务通用管理/U_BatchEditUnit.pas

100 lines
2.2 KiB
ObjectPascal
Raw Normal View History

2026-05-19 17:05:02 +08:00
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('<27><><EFBFBD><EFBFBD><EFBFBD>뵥λ', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
Exit;
end;
if FDRSIDList = '' then
Exit;
2026-07-18 17:32:59 +08:00
try
with ADOQuery1 do
begin
Close;
SQL.Clear;
if Fflag = 2 then
2026-05-19 17:05:02 +08:00
begin
SQL.Add('update Trade_Cloth_DR_Sub set QtyUnit = ' + QuotedStr(QtyUnit.Text) +
' where DRSID in (' + FDRSIDList + ')');
2026-07-18 17:32:59 +08:00
end
else if Fflag = 3 then
begin
SQL.Add('update Trade_Cloth_DR_Sub set QtyUnit = ' + QuotedStr(QtyUnit.Text) +
' where DRMID in (select distinct IONO from Trade_Cloth_IO where IOID in (' + FDRSIDList + '))');
2026-05-19 17:05:02 +08:00
end;
2026-07-18 17:32:59 +08:00
ExecSQL;
2026-05-19 17:05:02 +08:00
end;
2026-07-18 17:32:59 +08:00
finally
ModalResult := mrOk;
2026-05-19 17:05:02 +08:00
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('<27><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><><EFBFBD><EFBFBD>', mb_Ok + MB_ICONERROR);
end;
end;
end.