125 lines
2.6 KiB
ObjectPascal
125 lines
2.6 KiB
ObjectPascal
unit U_BatchEdit;
|
||
|
||
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
|
||
TfrmBatchEdit = class(TfrmBaseInput)
|
||
price: TcxTextEdit;
|
||
btnOK: TcxButton;
|
||
btnCancel: TcxButton;
|
||
cxLabel2: TcxLabel;
|
||
ADOConnection1: TADOConnection;
|
||
ADOQuery1: TADOQuery;
|
||
procedure btnOKClick(Sender: TObject);
|
||
procedure btnCancelClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
|
||
public
|
||
FBCIOID: string;
|
||
FStkId: string;
|
||
FIOID: string;
|
||
Fflag: Integer;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmBatchEdit: TfrmBatchEdit;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink;
|
||
{$R *.dfm}
|
||
|
||
|
||
procedure TfrmBatchEdit.btnCancelClick(Sender: TObject);
|
||
begin
|
||
close;
|
||
end;
|
||
|
||
procedure TfrmBatchEdit.btnOKClick(Sender: TObject);
|
||
begin
|
||
if price.Text = '' then
|
||
price.Text := 'null';
|
||
if (Fflag = 0) or (Fflag = 1) then
|
||
begin
|
||
if FBCIOID = '' then
|
||
exit;
|
||
try
|
||
with ADOQuery1 do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add(' update bs_cloth_io set price = ' + price.Text + ' where BCIOID in (' + FBCIOID + ')');
|
||
ExecSQL;
|
||
end;
|
||
finally
|
||
ModalResult := 1;;
|
||
end;
|
||
end
|
||
else if Fflag = 2 then
|
||
begin
|
||
if FStkId = '' then
|
||
exit;
|
||
try
|
||
with ADOQuery1 do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add(' update Trade_Cloth_Stock_ZD set ZDprice = ' + price.Text + ' where StkId in (' + FStkId + ')');
|
||
ExecSQL;
|
||
end;
|
||
finally
|
||
ModalResult := 1;;
|
||
end;
|
||
end
|
||
else if Fflag = 3 then
|
||
begin
|
||
if FIOID = '' then
|
||
exit;
|
||
try
|
||
with ADOQuery1 do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add(' update Trade_Cloth_IO set price = ' + price.Text + ' where IOID in (' + FIOID + ')');
|
||
// ShowMessage(sql.Text);
|
||
ExecSQL;
|
||
end;
|
||
finally
|
||
ModalResult := 1;;
|
||
end;
|
||
end;
|
||
|
||
|
||
|
||
end;
|
||
|
||
procedure TfrmBatchEdit.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.
|