You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
292 lines
9.1 KiB
Plaintext
292 lines
9.1 KiB
Plaintext
unit u_opor_ctn;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, bsSkinCtrls, BusinessSkinForm, Grids, Wwdbigrd, Wwdbgrid,
|
|
StdCtrls, wwdblook, DB, ADODB, Mask, wwdbedit, Wwdotdot, Wwdbcomb;
|
|
|
|
type
|
|
Tfrm_opor_ctn = class(TForm)
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
wwDBGrid1: TwwDBGrid;
|
|
wwDBLookupCombo1: TwwDBLookupCombo;
|
|
wwDBLookupCombo2: TwwDBLookupCombo;
|
|
t_op_ctn: TADOQuery;
|
|
t_op_ctn1: TDataSource;
|
|
Memo1: TMemo;
|
|
Memo2: TMemo;
|
|
Memo3: TMemo;
|
|
Memo4: TMemo;
|
|
bsSkinPanel1: TbsSkinPanel;
|
|
bsSkinButton1: TbsSkinButton;
|
|
bsSkinButton2: TbsSkinButton;
|
|
bsSkinButton4: TbsSkinButton;
|
|
bsSkinButton3: TbsSkinButton;
|
|
bsSkinButton6: TbsSkinButton;
|
|
bsSkinButton5: TbsSkinButton;
|
|
bsSkinButton9: TbsSkinButton;
|
|
t_ch_client: TADOQuery;
|
|
t_ch_client1: TDataSource;
|
|
procedure t_op_ctnAfterInsert(DataSet: TDataSet);
|
|
procedure t_op_ctnBeforePost(DataSet: TDataSet);
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
procedure bsSkinButton4Click(Sender: TObject);
|
|
procedure bsSkinButton3Click(Sender: TObject);
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
procedure FormShow(Sender: TObject);
|
|
procedure wwDBLookupCombo1Change(Sender: TObject);
|
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
|
procedure t_op_ctnAfterPost(DataSet: TDataSet);
|
|
procedure bsSkinButton9Click(Sender: TObject);
|
|
procedure bsSkinButton6Click(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
frm_opor_ctn: Tfrm_opor_ctn;
|
|
frm_opor_ctn_type:boolean;
|
|
opor_ctn_limited:string;
|
|
|
|
implementation
|
|
|
|
uses u_data_share, my_sys_function, u_main;
|
|
|
|
{$R *.dfm}
|
|
|
|
procedure Tfrm_opor_ctn.t_op_ctnAfterInsert(DataSet: TDataSet);
|
|
begin
|
|
t_op_ctn['OR_ID']:=t_op_ctn.DataSource.DataSet['OR_ID'];
|
|
t_op_ctn['ÊýÁ¿']:=1;
|
|
end;
|
|
|
|
procedure Tfrm_opor_ctn.t_op_ctnBeforePost(DataSet: TDataSet);
|
|
begin
|
|
if frm_data_share.t_code_ctn.Locate('´úÂë',t_op_ctn.fieldbyname('´úÂë').asstring,[]) then
|
|
begin
|
|
t_op_ctn['±íÏÖÐÎʽ']:=frm_data_share.t_code_ctn['±íÏÖÐÎʽ'];
|
|
if frm_data_share.t_code_ctn.FieldByName('³ß´ç').asstring='20'then
|
|
t_op_ctn['TEU']:=1*t_op_ctn.FieldByName('ÊýÁ¿').asinteger;
|
|
|
|
if (frm_data_share.t_code_ctn.FieldByName('³ß´ç').asstring='40')OR
|
|
(frm_data_share.t_code_ctn.FieldByName('³ß´ç').asstring='45')then
|
|
t_op_ctn['TEU']:=2*t_op_ctn.FieldByName('ÊýÁ¿').asinteger;
|
|
end
|
|
else
|
|
begin
|
|
t_op_ctn['´úÂë']:='';
|
|
t_op_ctn['±íÏÖÐÎʽ']:='';
|
|
t_op_ctn['ÏäÐÍ']:='';
|
|
t_op_ctn['³ß´ç']:='';
|
|
end;
|
|
|
|
table_before_post(t_op_ctn,'´úÂë');
|
|
table_before_post(t_op_ctn,'ÊýÁ¿');
|
|
end;
|
|
|
|
procedure Tfrm_opor_ctn.bsSkinButton1Click(Sender: TObject);
|
|
begin
|
|
t_op_ctn.insert;
|
|
end;
|
|
|
|
procedure Tfrm_opor_ctn.bsSkinButton2Click(Sender: TObject);
|
|
begin
|
|
table_post(t_op_ctn);
|
|
end;
|
|
|
|
procedure Tfrm_opor_ctn.bsSkinButton4Click(Sender: TObject);
|
|
begin
|
|
table_delete(t_op_ctn);
|
|
end;
|
|
|
|
procedure Tfrm_opor_ctn.bsSkinButton3Click(Sender: TObject);
|
|
begin
|
|
table_cancel(t_op_ctn);
|
|
end;
|
|
|
|
procedure Tfrm_opor_ctn.bsSkinButton5Click(Sender: TObject);
|
|
begin
|
|
close;
|
|
end;
|
|
|
|
procedure Tfrm_opor_ctn.FormShow(Sender: TObject);
|
|
begin
|
|
t_op_ctn.open;
|
|
frm_data_share.t_code_ctn.requery;
|
|
frm_data_share.t_code_package.requery;
|
|
end;
|
|
|
|
procedure Tfrm_opor_ctn.wwDBLookupCombo1Change(Sender: TObject);
|
|
begin
|
|
if (t_op_ctn.State=dsedit)or(t_op_ctn.State=dsinsert) then
|
|
begin
|
|
if frm_data_share.t_code_ctn.Locate('´úÂë',wwDBLookupCombo1.text,[]) then
|
|
begin
|
|
t_op_ctn['±íÏÖÐÎʽ']:=frm_data_share.t_code_ctn['±íÏÖÐÎʽ'];
|
|
t_op_ctn['ÏäÐÍ']:=frm_data_share.t_code_ctn['ÏäÐÍ'];
|
|
t_op_ctn['³ß´ç']:=frm_data_share.t_code_ctn['³ß´ç'];
|
|
end
|
|
else
|
|
begin
|
|
t_op_ctn['±íÏÖÐÎʽ']:='';
|
|
t_op_ctn['ÏäÐÍ']:='';
|
|
t_op_ctn['³ß´ç']:='';
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure Tfrm_opor_ctn.FormCloseQuery(Sender: TObject;
|
|
var CanClose: Boolean);
|
|
begin
|
|
CanClose:=frm_close_query(t_op_ctn);
|
|
end;
|
|
|
|
|
|
procedure Tfrm_opor_ctn.t_op_ctnAfterPost(DataSet: TDataSet);
|
|
begin
|
|
update_ctn(t_op_ctn);
|
|
end;
|
|
|
|
procedure Tfrm_opor_ctn.bsSkinButton9Click(Sender: TObject);
|
|
var
|
|
i:integer;
|
|
str:string;
|
|
begin
|
|
|
|
if t_op_ctn.IsEmpty then
|
|
exit;
|
|
if wwDBGrid1.SelectedList.Count>=1 then
|
|
begin
|
|
for i:=0 to wwDBGrid1.SelectedList.Count-1 do
|
|
begin
|
|
t_op_ctn.GotoBookmark(pointer(wwDBGrid1.SelectedList[i]));
|
|
if i=0 then
|
|
str:='('+t_op_ctn.fieldbyname('ctn_id').asstring
|
|
else
|
|
str:=str+','+t_op_ctn.fieldbyname('ctn_id').asstring;
|
|
end;
|
|
end
|
|
else
|
|
begin
|
|
str:='('+t_op_ctn.fieldbyname('ctn_id').asstring;
|
|
end;
|
|
str:=str+')';
|
|
|
|
|
|
t_ch_client.close;
|
|
t_ch_client.sql.clear;
|
|
t_ch_client.sql.add('select * from t_opor_ctn '
|
|
+'where ctn_id in '+str
|
|
+' order by ctn_id');
|
|
t_ch_client.open;
|
|
|
|
|
|
sys_print('º£Ô˳ö¿Ú×°Ïäµ¥',2,t_op_ctn.DataSource,nil,nil,nil,nil,t_ch_client1,t_op_ctn1,nil,nil,nil,nil);
|
|
|
|
|
|
end;
|
|
|
|
procedure Tfrm_opor_ctn.bsSkinButton6Click(Sender: TObject);
|
|
var
|
|
bok:Tbookmark;
|
|
if_first:boolean;
|
|
pkgs:integer;
|
|
kgs,cbm:double;
|
|
s,package:string;
|
|
begin
|
|
if t_op_ctn.IsEmpty then
|
|
exit;
|
|
t_op_ctn.First;
|
|
if_first:=true;
|
|
pkgs:=0;
|
|
kgs:=0.00;
|
|
cbm:=0.00;
|
|
bok:=t_op_ctn.GetBookmark;
|
|
try
|
|
t_op_ctn.DisableControls;
|
|
while not t_op_ctn.Eof do
|
|
begin
|
|
if strtobool(get_parameters_value(139,'true')) then begin
|
|
if if_first then
|
|
begin
|
|
if (Trim(t_op_ctn.fieldbyname('ÏäºÅ').asstring)<>'') then
|
|
// if (Trim(t_op_ctn.fieldbyname('ÏäºÅ').asstring)<>'') and (Trim(t_op_ctn.fieldbyname('·âºÅ').asstring)<>'') then
|
|
memo1.Lines.Text:=t_op_ctn.fieldbyname('ÏäºÅ').asstring+'/'+t_op_ctn.fieldbyname('·âºÅ').asstring;
|
|
memo2.Lines.Text:=t_op_ctn.fieldbyname('¼þÊý').asstring+t_op_ctn.fieldbyname('°ü×°').asstring;
|
|
memo3.Lines.Text:=t_op_ctn.fieldbyname('ÖØÁ¿').asstring+'KGS';
|
|
memo4.Lines.Text:=t_op_ctn.fieldbyname('³ßÂë').asstring+'CBM';
|
|
pkgs:=t_op_ctn.fieldbyname('¼þÊý').asinteger;
|
|
kgs:=t_op_ctn.fieldbyname('ÖØÁ¿').asfloat;
|
|
cbm:=t_op_ctn.fieldbyname('³ßÂë').asfloat;
|
|
package:=t_op_ctn.fieldbyname('°ü×°').asstring;
|
|
if_first:=false;
|
|
end
|
|
else
|
|
begin
|
|
memo2.Lines.Add(t_op_ctn.fieldbyname('¼þÊý').asstring+t_op_ctn.fieldbyname('°ü×°').asstring);
|
|
memo3.Lines.Add(t_op_ctn.fieldbyname('ÖØÁ¿').asstring+'KGS');
|
|
memo4.Lines.Add(t_op_ctn.fieldbyname('³ßÂë').asstring+'CBM');
|
|
pkgs:=pkgs+t_op_ctn.fieldbyname('¼þÊý').asinteger;
|
|
kgs:=kgs+t_op_ctn.fieldbyname('ÖØÁ¿').asfloat;
|
|
cbm:=cbm+t_op_ctn.fieldbyname('³ßÂë').asfloat;
|
|
package:=t_op_ctn.fieldbyname('°ü×°').asstring;
|
|
|
|
|
|
end;
|
|
end else begin
|
|
if if_first then
|
|
begin
|
|
memo1.Lines.Text:=t_op_ctn.fieldbyname('ÏäºÅ').asstring+'/'+t_op_ctn.fieldbyname('·âºÅ').asstring+'/'+t_op_ctn.fieldbyname('±íÏÖÐÎʽ').asstring+'/'
|
|
+t_op_ctn.fieldbyname('¼þÊý').asstring+t_op_ctn.fieldbyname('°ü×°').asstring+'/'+t_op_ctn.fieldbyname('ÖØÁ¿').asstring+'KGS'+'/'+t_op_ctn.fieldbyname('³ßÂë').asstring+'CBM';
|
|
memo2.Lines.Text:=t_op_ctn.fieldbyname('¼þÊý').asstring+t_op_ctn.fieldbyname('°ü×°').asstring;
|
|
memo3.Lines.Text:=t_op_ctn.fieldbyname('ÖØÁ¿').asstring+'KGS';
|
|
memo4.Lines.Text:=t_op_ctn.fieldbyname('³ßÂë').asstring+'CBM';
|
|
pkgs:=t_op_ctn.fieldbyname('¼þÊý').asinteger;
|
|
kgs:=t_op_ctn.fieldbyname('ÖØÁ¿').asfloat;
|
|
cbm:=t_op_ctn.fieldbyname('³ßÂë').asfloat;
|
|
package:=t_op_ctn.fieldbyname('°ü×°').asstring;
|
|
if_first:=false;
|
|
end
|
|
else
|
|
begin
|
|
memo2.Lines.Add(t_op_ctn.fieldbyname('¼þÊý').asstring+t_op_ctn.fieldbyname('°ü×°').asstring);
|
|
memo3.Lines.Add(t_op_ctn.fieldbyname('ÖØÁ¿').asstring+'KGS');
|
|
memo4.Lines.Add(t_op_ctn.fieldbyname('³ßÂë').asstring+'CBM');
|
|
pkgs:=pkgs+t_op_ctn.fieldbyname('¼þÊý').asinteger;
|
|
kgs:=kgs+t_op_ctn.fieldbyname('ÖØÁ¿').asfloat;
|
|
cbm:=cbm+t_op_ctn.fieldbyname('³ßÂë').asfloat;
|
|
package:=t_op_ctn.fieldbyname('°ü×°').asstring;
|
|
end;
|
|
end;
|
|
t_op_ctn.next;
|
|
end;
|
|
|
|
if (FormatFloat('0.0000;-0.0000;0',pkgs)<>FormatFloat('0.0000;-0.0000;0',t_op_ctn.DataSource.DataSet.FieldByName('¼þÊý').AsInteger))
|
|
or (FormatFloat('0.0000;-0.0000;0',kgs)<>FormatFloat('0.0000;-0.0000;0',t_op_ctn.DataSource.DataSet.FieldByName('ÖØÁ¿').AsFloat))
|
|
or (FormatFloat('0.0000;-0.0000;0',cbm)<>FormatFloat('0.0000;-0.0000;0',t_op_ctn.DataSource.DataSet.FieldByName('³ßÂë').AsFloat))
|
|
or ((Trim(package)<>'') and (Trim(package)<>Trim(t_op_ctn.DataSource.DataSet.fieldbyname('°ü×°').asstring)))
|
|
then
|
|
begin
|
|
if MessageDlg('»ù±¾ÐÅÏ¢µÄ¼þ,ÖØ,³ß,°ü×°ºÍ¼¯×°ÏäÐÅÏ¢µÄ¼þ,ÖØ,³ß,°ü×°²»Í¬,ÊÇ·ñ¸üÐÂ',mtWarning,[mbyes,mbno],0)=mrYes then
|
|
begin
|
|
t_op_ctn.DataSource.DataSet.edit;
|
|
t_op_ctn.DataSource.DataSet['¼þÊý°ü×°']:=memo2.Lines.Text;
|
|
t_op_ctn.DataSource.DataSet['»õÎïÖØÁ¿']:=memo3.Lines.Text;
|
|
t_op_ctn.DataSource.DataSet['»õÎï³ßÂë']:=memo4.Lines.Text;
|
|
t_op_ctn.DataSource.DataSet.post;
|
|
end;
|
|
end;
|
|
finally
|
|
t_op_ctn.EnableControls;
|
|
t_op_ctn.GotoBookmark(bok);
|
|
end;
|
|
|
|
end;
|
|
|
|
end.
|