|
|
|
|
unit u_op_Air_Goods;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
|
|
|
|
cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxClasses, cxControls,
|
|
|
|
|
cxGridCustomView, cxGridCustomTableView, cxGridTableView,
|
|
|
|
|
cxGridDBTableView, cxGrid, ADODB, bsSkinCtrls, cxCalc, cxNavigator,
|
|
|
|
|
cxDBNavigator, cxLabel, cxContainer, cxTextEdit, cxMaskEdit,
|
|
|
|
|
cxDropDownEdit;
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
Tfrm_op_Air_Goods = class(TForm)
|
|
|
|
|
cxGrid1DBTableView1: TcxGridDBTableView;
|
|
|
|
|
cxGrid1Level1: TcxGridLevel;
|
|
|
|
|
cxGrid1: TcxGrid;
|
|
|
|
|
t_op_Air_Goods1: TDataSource;
|
|
|
|
|
t_op_Air_Goods: TADOQuery;
|
|
|
|
|
cxGrid1DBTableView1DBColumn1: TcxGridDBColumn;
|
|
|
|
|
cxGrid1DBTableView1DBColumn2: TcxGridDBColumn;
|
|
|
|
|
cxGrid1DBTableView1DBColumn3: TcxGridDBColumn;
|
|
|
|
|
cxGrid1DBTableView1DBColumn4: TcxGridDBColumn;
|
|
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
|
|
cxDBNavigator1: TcxDBNavigator;
|
|
|
|
|
cxCalcEdit1: TcxCalcEdit;
|
|
|
|
|
cxLabel1: TcxLabel;
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
procedure t_op_Air_GoodsAfterInsert(DataSet: TDataSet);
|
|
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
|
|
procedure t_op_Air_GoodsBeforePost(DataSet: TDataSet);
|
|
|
|
|
private
|
|
|
|
|
{ Private declarations }
|
|
|
|
|
public
|
|
|
|
|
{ Public declarations }
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
frm_op_Air_Goods: Tfrm_op_Air_Goods;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
uses u_main,my_sys_function;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_op_Air_Goods.FormShow(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
t_op_Air_Goods.Open;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_op_Air_Goods.t_op_Air_GoodsAfterInsert(DataSet: TDataSet);
|
|
|
|
|
begin
|
|
|
|
|
t_op_Air_Goods['<27><><EFBFBD><EFBFBD>']:=t_op_Air_Goods.DataSource.DataSet['<27><><EFBFBD><EFBFBD>'];
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_op_Air_Goods.bsSkinButton1Click(Sender: TObject);
|
|
|
|
|
var aAdoQuery:TAdoQuery;
|
|
|
|
|
d_Weight,cmb:Double;
|
|
|
|
|
qty:Integer;
|
|
|
|
|
begin
|
|
|
|
|
//
|
|
|
|
|
d_Weight:=0;
|
|
|
|
|
cmb:=0;
|
|
|
|
|
qty:=0;
|
|
|
|
|
if cxCalcEdit1.Value=0 then
|
|
|
|
|
begin
|
|
|
|
|
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
aAdoQuery:=CreateAdoQuery;
|
|
|
|
|
with aAdoQuery do
|
|
|
|
|
try
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
sql.Add('Select * from t_op_Air_Goods');
|
|
|
|
|
sql.Add('where <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
|
|
|
|
|
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=t_op_Air_Goods.DataSource.DataSet['<27><><EFBFBD><EFBFBD>'];
|
|
|
|
|
Open;First;
|
|
|
|
|
while not Eof do
|
|
|
|
|
begin
|
|
|
|
|
qty:=qty+FieldByName('<27><><EFBFBD><EFBFBD>').AsInteger;
|
|
|
|
|
cmb:=cmb+FieldByName('<27><>').Value*FieldByName('<27><>').Value*FieldByName('<27><>').Value*FieldByName('<27><><EFBFBD><EFBFBD>').Value;
|
|
|
|
|
d_Weight:=d_Weight+FieldByName('<27><>').Value*FieldByName('<27><>').Value*FieldByName('<27><>').Value*FieldByName('<27><><EFBFBD><EFBFBD>').Value;
|
|
|
|
|
Next;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
t_op_Air_Goods.DataSource.DataSet.Edit;
|
|
|
|
|
t_op_Air_Goods.DataSource.DataSet['<27><><EFBFBD><EFBFBD>']:=qty;
|
|
|
|
|
t_op_Air_Goods.DataSource.DataSet['<27><><EFBFBD><EFBFBD>']:=d_Weight/cxCalcEdit1.Value;
|
|
|
|
|
t_op_Air_Goods.DataSource.DataSet['<27>Ƽ<EFBFBD><C6BC><EFBFBD><EFBFBD><EFBFBD>']:=d_Weight/cxCalcEdit1.Value;
|
|
|
|
|
t_op_Air_Goods.DataSource.DataSet['<27><><EFBFBD><EFBFBD>']:=cmb/1000000;
|
|
|
|
|
t_op_Air_Goods.DataSource.DataSet.Post;
|
|
|
|
|
{
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
sql.Add('update t_op_Aire set <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
|
|
|
|
|
sql.Add('where <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
|
|
|
|
|
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=t_op_Air_Goods.DataSource.DataSet['<27><><EFBFBD><EFBFBD>'];
|
|
|
|
|
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=d_Weight/cxCalcEdit1.Value;
|
|
|
|
|
ExecSQL;
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
Free;
|
|
|
|
|
end;
|
|
|
|
|
Close;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_op_Air_Goods.t_op_Air_GoodsBeforePost(DataSet: TDataSet);
|
|
|
|
|
begin
|
|
|
|
|
if DataSet.FieldByName('<27><>').Value=0 then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0<CEAA><30><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1>棡');
|
|
|
|
|
abort;
|
|
|
|
|
end;
|
|
|
|
|
if DataSet.FieldByName('<27><>').Value=0 then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0<CEAA><30><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1>棡');
|
|
|
|
|
abort;
|
|
|
|
|
end;
|
|
|
|
|
if DataSet.FieldByName('<27><>').Value=0 then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('<27>߲<EFBFBD><DFB2><EFBFBD>Ϊ0<CEAA><30><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1>棡');
|
|
|
|
|
abort;
|
|
|
|
|
end;
|
|
|
|
|
if DataSet.FieldByName('<27><><EFBFBD><EFBFBD>').Value=0 then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0<CEAA><30><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1>棡');
|
|
|
|
|
abort;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|