100 lines
2.2 KiB
ObjectPascal
100 lines
2.2 KiB
ObjectPascal
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;
|
|
|
|
try
|
|
with ADOQuery1 do
|
|
begin
|
|
Close;
|
|
SQL.Clear;
|
|
if Fflag = 2 then
|
|
begin
|
|
SQL.Add('update Trade_Cloth_DR_Sub set QtyUnit = ' + QuotedStr(QtyUnit.Text) +
|
|
' where DRSID in (' + FDRSIDList + ')');
|
|
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 + '))');
|
|
end;
|
|
ExecSQL;
|
|
end;
|
|
finally
|
|
ModalResult := mrOk;
|
|
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.
|
|
|