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.
270 lines
8.5 KiB
Plaintext
270 lines
8.5 KiB
Plaintext
unit u_op_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_op_ctn = class(TForm)
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
wwDBGrid1: TwwDBGrid;
|
|
wwDBLookupCombo1: 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;
|
|
bsSkinButton5: TbsSkinButton;
|
|
bsSkinButton9: TbsSkinButton;
|
|
t_ch_client: TADOQuery;
|
|
t_ch_client1: TDataSource;
|
|
t_load_ctn: TADOQuery;
|
|
wwDBComboBoxcns: TwwDBComboBox;
|
|
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_ctnBeforeDelete(DataSet: TDataSet);
|
|
procedure t_op_ctnBeforeEdit(DataSet: TDataSet);
|
|
procedure t_op_ctnAfterPost(DataSet: TDataSet);
|
|
private
|
|
{ Private declarations }
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
frm_op_ctn: Tfrm_op_ctn;
|
|
frm_op_ctn_type:boolean;
|
|
op_ctn_limited:string;
|
|
|
|
implementation
|
|
|
|
uses u_data_share, my_sys_function, u_op_seae, u_op_seai, u_main;
|
|
|
|
{$R *.dfm}
|
|
|
|
procedure Tfrm_op_ctn.t_op_ctnAfterInsert(DataSet: TDataSet);
|
|
begin
|
|
t_op_ctn['񅧏']:=t_op_ctn.DataSource.DataSet['񅧏'];
|
|
t_op_ctn['Ïä״̬']:='F';
|
|
t_op_ctn['ÊýÁ¿']:=1;
|
|
|
|
end;
|
|
|
|
procedure Tfrm_op_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_op_ctn.bsSkinButton1Click(Sender: TObject);
|
|
begin
|
|
t_op_ctn.insert;
|
|
end;
|
|
|
|
procedure Tfrm_op_ctn.bsSkinButton2Click(Sender: TObject);
|
|
begin
|
|
table_post(t_op_ctn);
|
|
end;
|
|
|
|
procedure Tfrm_op_ctn.bsSkinButton4Click(Sender: TObject);
|
|
begin
|
|
table_delete(t_op_ctn);
|
|
end;
|
|
|
|
procedure Tfrm_op_ctn.bsSkinButton3Click(Sender: TObject);
|
|
begin
|
|
table_cancel(t_op_ctn);
|
|
end;
|
|
|
|
procedure Tfrm_op_ctn.bsSkinButton5Click(Sender: TObject);
|
|
begin
|
|
close;
|
|
end;
|
|
|
|
procedure Tfrm_op_ctn.FormShow(Sender: TObject);
|
|
begin
|
|
t_op_ctn.open;
|
|
if frm_op_ctn_type then
|
|
frm_data_share.t_code_ctn.requery;
|
|
frm_data_share.t_code_package.requery;
|
|
end;
|
|
|
|
procedure Tfrm_op_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_op_ctn.FormCloseQuery(Sender: TObject;
|
|
var CanClose: Boolean);
|
|
begin
|
|
CanClose:=frm_close_query(t_op_ctn);
|
|
end;
|
|
|
|
procedure Tfrm_op_ctn.t_op_ctnBeforeDelete(DataSet: TDataSet);
|
|
var
|
|
aQuery:TAdoQuery;
|
|
begin
|
|
if t_op_ctn.RecordCount=1 then
|
|
begin
|
|
if t_op_ctn.DataSource.DataSet.FieldByName('×°ÔË·½Ê½').asstring='ÕûÏä' then
|
|
begin
|
|
if (Trim(t_op_ctn.DataSource.DataSet.fieldbyname('ÒµÎñÀàÐÍ').asstring)<>'¸ü¸Äµ¥') then begin
|
|
showmessage('ÒµÎñ¼¯×°Ïä²»ÄÜΪ¿Õ£¬Äã²»ÄÜɾ³ý£¡£¡');
|
|
abort;
|
|
end;
|
|
end;
|
|
end;
|
|
if op_ctn_limited='0001'then
|
|
begin
|
|
op_befor_post(TADOQuery(t_op_ctn.DataSource.DataSet),op_ctn_limited);
|
|
end
|
|
else
|
|
begin
|
|
op_befor_post(TADOQuery(t_op_ctn.DataSource.DataSet),op_ctn_limited);
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure Tfrm_op_ctn.t_op_ctnBeforeEdit(DataSet: TDataSet);
|
|
begin
|
|
if op_ctn_limited='0001'then
|
|
begin
|
|
op_befor_post(TADOQuery(t_op_ctn.DataSource.DataSet),op_ctn_limited);
|
|
end
|
|
else
|
|
begin
|
|
op_befor_post(TADOQuery(t_op_ctn.DataSource.DataSet),op_ctn_limited);
|
|
end;
|
|
end;
|
|
|
|
procedure Tfrm_op_ctn.t_op_ctnAfterPost(DataSet: TDataSet);
|
|
var
|
|
aQuery:TADOQuery;
|
|
i:integer;
|
|
begin
|
|
aQuery:=CreateAdoQuery;
|
|
try
|
|
t_load_ctn.open;
|
|
if t_load_ctn.IsEmpty then begin
|
|
t_op_ctn.First;
|
|
while not t_op_ctn.Eof do begin
|
|
for i:=0 to t_op_ctn.fieldbyname('ÊýÁ¿').AsInteger-1 do begin
|
|
t_load_ctn.Insert;
|
|
t_load_ctn.FieldByName('񅧏').AsString:=t_op_ctn.fieldbyname('񅧏').AsString;
|
|
t_load_ctn.FieldByName('´úÂë').AsString:=t_op_ctn.fieldbyname('´úÂë').AsString;
|
|
t_load_ctn.FieldByName('³ß´ç').AsString:=t_op_ctn.fieldbyname('³ß´ç').AsString;
|
|
t_load_ctn.FieldByName('ÏäÐÍ').AsString:=t_op_ctn.fieldbyname('ÏäÐÍ').AsString;
|
|
t_load_ctn.FieldByName('±íÏÖÐÎʽ').AsString:=t_op_ctn.fieldbyname('±íÏÖÐÎʽ').AsString;
|
|
t_load_ctn['SOC']:=t_op_ctn['SOC'];
|
|
if t_op_ctn.fieldbyname('Ïä״̬').AsString<>'' then
|
|
t_load_ctn.FieldByName('Ïä״̬').AsString:=t_op_ctn.fieldbyname('Ïä״̬').AsString
|
|
else
|
|
t_load_ctn.FieldByName('Ïä״̬').AsString:='F';
|
|
t_load_ctn.FieldByName('ÊýÁ¿').AsInteger:=1;
|
|
if t_op_ctn.fieldbyname('³ß´ç').AsString='20'then
|
|
t_load_ctn['TEU']:=1;
|
|
if (t_op_ctn.FieldByName('³ß´ç').asstring='40')OR
|
|
(t_op_ctn.FieldByName('³ß´ç').asstring='45')then
|
|
t_load_ctn['TEU']:=2;
|
|
if frm_data_share.t_code_ctn.Locate('´úÂë',t_op_ctn.fieldbyname('´úÂë').asstring,[]) then
|
|
t_load_ctn['ÏäƤÖØ']:=frm_data_share.t_code_ctn['ÏäƤÖØ'];
|
|
t_load_ctn.Post;
|
|
end;
|
|
t_op_ctn.Next;
|
|
end;
|
|
|
|
end else begin
|
|
with aQuery do begin
|
|
Close;
|
|
aQuery.SQL.Text:='delete from t_op_ctn where 񅧏='''+t_op_ctn.fieldbyname('񅧏').AsString+'''';
|
|
ExecSQL;
|
|
end;
|
|
t_load_ctn.close;
|
|
t_load_ctn.Open;
|
|
t_op_ctn.First;
|
|
while not t_op_ctn.Eof do begin
|
|
for i:=0 to t_op_ctn.fieldbyname('ÊýÁ¿').AsInteger-1 do begin
|
|
t_load_ctn.Insert;
|
|
t_load_ctn.FieldByName('񅧏').AsString:=t_op_ctn.fieldbyname('񅧏').AsString;
|
|
t_load_ctn.FieldByName('´úÂë').AsString:=t_op_ctn.fieldbyname('´úÂë').AsString;
|
|
t_load_ctn.FieldByName('³ß´ç').AsString:=t_op_ctn.fieldbyname('³ß´ç').AsString;
|
|
t_load_ctn.FieldByName('ÏäÐÍ').AsString:=t_op_ctn.fieldbyname('ÏäÐÍ').AsString;
|
|
t_load_ctn.FieldByName('±íÏÖÐÎʽ').AsString:=t_op_ctn.fieldbyname('±íÏÖÐÎʽ').AsString;
|
|
if t_op_ctn.fieldbyname('Ïä״̬').AsString<>'' then
|
|
t_load_ctn.FieldByName('Ïä״̬').AsString:=t_op_ctn.fieldbyname('Ïä״̬').AsString
|
|
else
|
|
t_load_ctn.FieldByName('Ïä״̬').AsString:='F';
|
|
t_load_ctn.FieldByName('ÊýÁ¿').AsInteger:=1;
|
|
if t_op_ctn.fieldbyname('³ß´ç').AsString='20'then
|
|
t_load_ctn['TEU']:=1;
|
|
if (t_op_ctn.FieldByName('³ß´ç').asstring='40')OR
|
|
(t_op_ctn.FieldByName('³ß´ç').asstring='45')then
|
|
t_load_ctn['TEU']:=2;
|
|
if frm_data_share.t_code_ctn.Locate('´úÂë',t_op_ctn.fieldbyname('´úÂë').asstring,[]) then
|
|
t_load_ctn['ÏäƤÖØ']:=frm_data_share.t_code_ctn['ÏäƤÖØ'];
|
|
t_load_ctn.Post;
|
|
end;
|
|
t_op_ctn.Next;
|
|
end;
|
|
|
|
MessageDlg('¼¯×°Ïä×°ÏäÃ÷ϸҲÒÑÐ޸ģ¬Çë×Ðϸ¼ì²é£¡',mtWarning,[mbok],0);
|
|
end;
|
|
|
|
finally
|
|
FreeAndNil(aQuery);
|
|
end;
|
|
update_ctn(t_op_ctn);
|
|
|
|
end;
|
|
|
|
end.
|