2025-11-08 10:16:26 +08:00
|
|
|
|
unit U_BatchEdit;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
2026-05-13 09:12:14 +08:00
|
|
|
|
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;
|
2025-11-08 10:16:26 +08:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TfrmBatchEdit = class(TfrmBaseInput)
|
|
|
|
|
|
price: TcxTextEdit;
|
|
|
|
|
|
btnOK: TcxButton;
|
|
|
|
|
|
btnCancel: TcxButton;
|
|
|
|
|
|
cxLabel2: TcxLabel;
|
|
|
|
|
|
ADOConnection1: TADOConnection;
|
|
|
|
|
|
ADOQuery1: TADOQuery;
|
2026-05-13 09:12:14 +08:00
|
|
|
|
priceGW: TcxTextEdit;
|
|
|
|
|
|
cxLabel1: TcxLabel;
|
2025-11-08 10:16:26 +08:00
|
|
|
|
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
|
2026-05-13 09:12:14 +08:00
|
|
|
|
|
2025-11-08 10:16:26 +08:00
|
|
|
|
uses
|
|
|
|
|
|
U_DataLink;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmBatchEdit.btnCancelClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmBatchEdit.btnOKClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (Fflag = 0) or (Fflag = 1) then
|
|
|
|
|
|
begin
|
2026-05-13 09:12:14 +08:00
|
|
|
|
if price.Text = '' then
|
|
|
|
|
|
price.Text := 'null';
|
2025-11-08 10:16:26 +08:00
|
|
|
|
if FBCIOID = '' then
|
|
|
|
|
|
exit;
|
|
|
|
|
|
try
|
|
|
|
|
|
with ADOQuery1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
close;
|
|
|
|
|
|
sql.Clear;
|
2026-05-13 09:12:14 +08:00
|
|
|
|
sql.Add(' update bs_cloth_io set price = ' + price.Text + ' where BCIOID in (' + FBCIOID + ')');
|
2025-11-08 10:16:26 +08:00
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
2026-05-13 09:12:14 +08:00
|
|
|
|
ModalResult := 1;
|
|
|
|
|
|
;
|
2025-11-08 10:16:26 +08:00
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
|
|
|
else if Fflag = 2 then
|
|
|
|
|
|
begin
|
2026-05-13 09:12:14 +08:00
|
|
|
|
if price.Text = '' then
|
|
|
|
|
|
price.Text := 'null';
|
2025-11-08 10:16:26 +08:00
|
|
|
|
if FStkId = '' then
|
|
|
|
|
|
exit;
|
|
|
|
|
|
try
|
|
|
|
|
|
with ADOQuery1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
close;
|
|
|
|
|
|
sql.Clear;
|
2026-05-13 09:12:14 +08:00
|
|
|
|
sql.Add(' update Trade_Cloth_Stock_ZD set ZDprice = ' + price.Text + ' where StkId in (' + FStkId + ')');
|
2025-11-08 10:16:26 +08:00
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
2026-05-13 09:12:14 +08:00
|
|
|
|
ModalResult := 1;
|
|
|
|
|
|
;
|
2025-11-08 10:16:26 +08:00
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
|
|
|
else if Fflag = 3 then
|
|
|
|
|
|
begin
|
2026-05-13 09:12:14 +08:00
|
|
|
|
if (price.Text <> '') and (priceGW.Text <> '') then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('ֻ<><D6BB><EFBFBD><EFBFBD>дһ<D0B4><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2025-11-08 10:16:26 +08:00
|
|
|
|
if FIOID = '' then
|
|
|
|
|
|
exit;
|
|
|
|
|
|
try
|
|
|
|
|
|
with ADOQuery1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
close;
|
|
|
|
|
|
sql.Clear;
|
2026-05-13 09:12:14 +08:00
|
|
|
|
if (price.Text = '') and (priceGW.Text = '') then
|
|
|
|
|
|
begin
|
|
|
|
|
|
sql.Add(' update Trade_Cloth_IO set price = ' + price.Text + ' where IOID in (' + FIOID + ')');
|
|
|
|
|
|
sql.Add(' update Trade_Cloth_IO set Amount = ' + price.Text + ' where IOID in (' + FIOID + ')');
|
|
|
|
|
|
end
|
|
|
|
|
|
else if (price.Text <> '') and (priceGW.Text = '') then
|
|
|
|
|
|
begin
|
|
|
|
|
|
sql.Add(' update Trade_Cloth_IO set price = ' + price.Text + ' where IOID in (' + FIOID + ')');
|
|
|
|
|
|
sql.Add(' update Trade_Cloth_IO set Amount = ' + price.Text + ' * meter where IOID in (' + FIOID + ')');
|
|
|
|
|
|
end
|
|
|
|
|
|
else if (price.Text = '') and (priceGW.Text <> '') then
|
|
|
|
|
|
begin
|
|
|
|
|
|
sql.Add(' update Trade_Cloth_IO set price = ' + priceGW.Text + ' where IOID in (' + FIOID + ')');
|
|
|
|
|
|
sql.Add(' update Trade_Cloth_IO set Amount = ' + priceGW.Text + ' * NetWeight where IOID in (' + FIOID + ')');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-08 10:16:26 +08:00
|
|
|
|
// ShowMessage(sql.Text);
|
|
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
2026-05-13 09:12:14 +08:00
|
|
|
|
ModalResult := 1;
|
|
|
|
|
|
;
|
2025-11-08 10:16:26 +08:00
|
|
|
|
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;
|
2026-05-13 09:12:14 +08:00
|
|
|
|
if FFlag = 3 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
priceGW.Visible := true;
|
|
|
|
|
|
cxLabel1.Visible := True;
|
|
|
|
|
|
cxLabel2.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD>۸<EFBFBD>';
|
|
|
|
|
|
end;
|
2025-11-08 10:16:26 +08:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|
2026-05-13 09:12:14 +08:00
|
|
|
|
|