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.

322 lines
10 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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;
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;
btnMarks: TbsSkinButton;
btnDesc: TbsSkinButton;
atncfld_op_ctnctn_id: TAutoIncField;
strngfld_op_ctnDSDesigner2: TStringField;
strngfld_op_ctnDSDesigner3: TStringField;
strngfld_op_ctnDSDesigner4: TStringField;
intgrfld_op_ctnDSDesigner5: TIntegerField;
intgrfld_op_ctnTEU: TIntegerField;
strngfld_op_ctnDSDesigner6: TStringField;
strngfld_op_ctnDSDesigner7: TStringField;
strngfld_op_ctnDSDesigner8: TStringField;
intgrfld_op_ctnDSDesigner9: TIntegerField;
strngfld_op_ctnDSDesigner10: TStringField;
bcdfld_op_ctnDSDesigner11: TBCDField;
bcdfld_op_ctnDSDesigner12: TBCDField;
strngfld_op_ctnDSDesigner13: TStringField;
strngfld_op_ctnDSDesigner14: TStringField;
strngfld_op_ctnDSDesigner1: TStringField;
bcdfld_op_ctnDSDesigner15: TBCDField;
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 bsSkinButton6Click(Sender: TObject);
procedure t_op_ctnBeforeDelete(DataSet: TDataSet);
procedure t_op_ctnBeforeEdit(DataSet: TDataSet);
procedure t_op_ctnAfterPost(DataSet: TDataSet);
procedure btnDescClick(Sender: TObject);
procedure btnMarksClick(Sender: TObject);
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['<27><><EFBFBD><EFBFBD>']:=t_op_ctn.DataSource.DataSet['<27><><EFBFBD><EFBFBD>'];
t_op_ctn['<27><><EFBFBD><EFBFBD>']:=1;
end;
procedure Tfrm_op_ctn.t_op_ctnBeforePost(DataSet: TDataSet);
var
aQuery:TADOQuery;
begin
if frm_data_share.t_code_ctn.Locate('<27><><EFBFBD><EFBFBD>',t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,[]) then
begin
t_op_ctn['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ']:=frm_data_share.t_code_ctn['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ'];
if frm_data_share.t_code_ctn.FieldByName('<27>ߴ<EFBFBD>').asstring='20'then
t_op_ctn['TEU']:=1*t_op_ctn.FieldByName('<27><><EFBFBD><EFBFBD>').asinteger;
if (frm_data_share.t_code_ctn.FieldByName('<27>ߴ<EFBFBD>').asstring='40')OR
(frm_data_share.t_code_ctn.FieldByName('<27>ߴ<EFBFBD>').asstring='45')then
t_op_ctn['TEU']:=2*t_op_ctn.FieldByName('<27><><EFBFBD><EFBFBD>').asinteger;
end
else
begin
t_op_ctn['<27><><EFBFBD><EFBFBD>']:='';
t_op_ctn['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ']:='';
t_op_ctn['<27><><EFBFBD><EFBFBD>']:='';
t_op_ctn['<27>ߴ<EFBFBD>']:='';
end;
table_before_post(t_op_ctn,'<27><><EFBFBD><EFBFBD>');
table_before_post(t_op_ctn,'<27><><EFBFBD><EFBFBD>');
if not frm_data_share.t_code_line_ctn.active then
frm_data_share.t_code_line_ctn.Open;
if frm_data_share.t_code_line_ctn.IsEmpty then
exit;
if t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').OldValue<>null then
if (t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').OldValue<>t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').Value) or (t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').OldValue<>t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').Value) then
if (Pos(trim(frm_data_share.t_code_line_ctn.fieldbyname('<27>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>1').asstring),t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').OldValue)>0)
or (Pos(trim(frm_data_share.t_code_line_ctn.fieldbyname('<27>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>2').asstring),t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').OldValue)>0)
or (Pos(trim(frm_data_share.t_code_line_ctn.fieldbyname('<27>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>3').asstring),t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').OldValue)>0)
or (Pos(trim(frm_data_share.t_code_line_ctn.fieldbyname('<27>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>4').asstring),t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').OldValue)>0)
or (Pos(trim(frm_data_share.t_code_line_ctn.fieldbyname('<27>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>5').asstring),t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').OldValue)>0)
or (Pos(trim(frm_data_share.t_code_line_ctn.fieldbyname('<27>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>6').asstring),t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').OldValue)>0)
or (Pos(trim(frm_data_share.t_code_line_ctn.fieldbyname('<27>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>2').asstring),t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').Value)>0)
or (Pos(trim(frm_data_share.t_code_line_ctn.fieldbyname('<27>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>3').asstring),t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').Value)>0)
or (Pos(trim(frm_data_share.t_code_line_ctn.fieldbyname('<27>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>4').asstring),t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').Value)>0)
or (Pos(trim(frm_data_share.t_code_line_ctn.fieldbyname('<27>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>5').asstring),t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').Value)>0)
or (Pos(trim(frm_data_share.t_code_line_ctn.fieldbyname('<27>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>6').asstring),t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').Value)>0)
or (Pos(trim(frm_data_share.t_code_line_ctn.fieldbyname('<27>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>1').asstring),t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').Value)>0)
then begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select * from t_ch_fee where ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>=1');
sql.add(' and <20><><EFBFBD><EFBFBD>='''+t_op_ctn.FieldByName('<27><><EFBFBD><EFBFBD>').AsString+'''');
Open;
if not IsEmpty then begin
MessageDlg('ϵͳ<CFB5>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD>ã<EFBFBD><C3A3><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>ͺ<EFBFBD><CDBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>!',mtWarning,[mbOK],0);
Abort;
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
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
bsSkinButton6.Enabled:=true;
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('<27><><EFBFBD><EFBFBD>',wwDBLookupCombo1.text,[]) then
begin
t_op_ctn['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ']:=frm_data_share.t_code_ctn['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ'];
t_op_ctn['<27><><EFBFBD><EFBFBD>']:=frm_data_share.t_code_ctn['<27><><EFBFBD><EFBFBD>'];
t_op_ctn['<27>ߴ<EFBFBD>']:=frm_data_share.t_code_ctn['<27>ߴ<EFBFBD>'];
end
else
begin
t_op_ctn['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ']:='';
t_op_ctn['<27><><EFBFBD><EFBFBD>']:='';
t_op_ctn['<27>ߴ<EFBFBD>']:='';
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.bsSkinButton6Click(Sender: TObject);
var
bok:Tbookmark;
if_first:boolean;
begin
if t_op_ctn.IsEmpty then
exit;
if op_ctn_limited='0001'then
begin
op_befor_post(frm_op_seae.t_op_seae,op_ctn_limited);
end
else
begin
op_befor_post(frm_op_seai.t_op_seai,op_ctn_limited);
end;
t_op_ctn.First;
if_first:=true;
bok:=t_op_ctn.GetBookmark;
while not t_op_ctn.Eof do
begin
if if_first then
begin
memo1.Lines.Text:=t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'/'+t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
memo2.Lines.Text:=t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+t_op_ctn.fieldbyname('<27><>װ').asstring;
memo3.Lines.Text:=t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'KGS';
memo4.Lines.Text:=t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'CBM';
if_first:=false;
end
else
begin
// memo1.Lines.Add(' ');
memo1.Lines.Add(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'/'+t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
memo2.Lines.Add(' ');
memo2.Lines.Add(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+t_op_ctn.fieldbyname('<27><>װ').asstring);
memo3.Lines.Add(' ');
memo3.Lines.Add(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'KGS');
memo4.Lines.Add(' ');
memo4.Lines.Add(t_op_ctn.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'CBM');
end;
t_op_ctn.next;
end;
t_op_ctn.DataSource.DataSet.edit;
t_op_ctn.DataSource.DataSet['<27><><EFBFBD>ŷ<EFBFBD><C5B7><EFBFBD>']:=memo1.Lines.Text;
t_op_ctn.DataSource.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ']:=memo2.Lines.Text;
t_op_ctn.DataSource.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=memo3.Lines.Text;
t_op_ctn.DataSource.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=memo4.Lines.Text;
t_op_ctn.DataSource.DataSet.post;
t_op_ctn.GotoBookmark(bok);
end;
procedure Tfrm_op_ctn.t_op_ctnBeforeDelete(DataSet: TDataSet);
begin
if t_op_ctn.RecordCount=1 then
begin
if t_op_ctn.DataSource.DataSet.FieldByName('װ<>˷<EFBFBD>ʽ').asstring='<27><><EFBFBD><EFBFBD>' then
begin
showmessage('ҵ<><D2B5><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><E4B2BB>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD><E3B2BB>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
abort;
end;
end;
if op_ctn_limited='0001'then
begin
op_befor_post(frm_op_seae.t_op_seae,op_ctn_limited);
end
else
begin
op_befor_post(frm_op_seai.t_op_seai,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(frm_op_seae.t_op_seae,op_ctn_limited);
end
else
begin
op_befor_post(frm_op_seai.t_op_seai,op_ctn_limited);
end;
end;
procedure Tfrm_op_ctn.t_op_ctnAfterPost(DataSet: TDataSet);
begin
update_ctn(t_op_ctn);
if CheckCtnTotalEquelItems(TADOQuery(t_op_ctn1.dataset)) then
begin
if MessageDlg('װ<><D7B0><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD><EFBFBD>ء<EFBFBD><D8A1>߲<EFBFBD><DFB2><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>£<EFBFBD>',mtWarning,mbOKCancel,0)=mrok then begin
bsSkinButton6.OnClick(nil);
end;
// abort;
end;
end;
procedure Tfrm_op_ctn.btnDescClick(Sender: TObject);
begin
frm_main.view_momo(t_op_ctn1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure Tfrm_op_ctn.btnMarksClick(Sender: TObject);
begin
frm_main.view_momo(t_op_ctn1,'<27><>ͷ');
end;
end.