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.
DS6JIEFENG/海运业务/u_op_seae_vessel_change.pas

412 lines
12 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_seae_vessel_change;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, ExtCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl,
dxDBGrid, DB, ADODB, dxDBTLCl, dxGrClms, wwdbdatetimepicker, Mask,
DBCtrls, StdCtrls, wwdblook, bsdbctrls;
type
Tfrm_op_seae_vessel_change = class(TForm)
Panel2: TPanel;
bsSkinButton7: TbsSkinButton;
bsSkinButton6: TbsSkinButton;
bsSkinButton10: TbsSkinButton;
bsSkinButton1: TbsSkinButton;
bsSkinButton11: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
Notebook1: TNotebook;
dxDBGrid1: TdxDBGrid;
t_op_seae_vessel: TADOQuery;
t_op_seae_vessel1: TDataSource;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1Column2: TdxDBGridMaskColumn;
dxDBGrid1Column3: TdxDBGridDateColumn;
dxDBGrid1Column4: TdxDBGridDateColumn;
dxDBGrid1Column5: TdxDBGridMaskColumn;
dxDBGrid1Column6: TdxDBGridMaskColumn;
dxDBGrid1Column7: TdxDBGridDateColumn;
dxDBGrid1Column8: TdxDBGridDateColumn;
dxDBGrid1Column9: TdxDBGridMaskColumn;
dxDBGrid1Column10: TdxDBGridDateColumn;
v_vessel_change: TADOQuery;
v_vessel_change1: TDataSource;
bsSkinPanel1: TbsSkinPanel;
Label125: TLabel;
wwDBLookupCombo49: TwwDBLookupCombo;
Button1: TButton;
Label126: TLabel;
DBEdit63: TDBEdit;
Label15: TLabel;
wwDBDateTimePicker2: TwwDBDateTimePicker;
Label25: TLabel;
wwDBDateTimePicker6: TwwDBDateTimePicker;
Label1: TLabel;
wwDBLookupCombo1: TwwDBLookupCombo;
Button2: TButton;
Label2: TLabel;
DBEdit1: TDBEdit;
Label3: TLabel;
wwDBDateTimePicker1: TwwDBDateTimePicker;
Label4: TLabel;
wwDBDateTimePicker3: TwwDBDateTimePicker;
Label5: TLabel;
DBEdit2: TDBEdit;
Label6: TLabel;
DBEdit3: TDBEdit;
bsSkinButton8: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton12: TbsSkinButton;
Label7: TLabel;
DBMemo1: TDBMemo;
dxDBGrid2: TdxDBGrid;
dxDBGrid2Column3: TdxDBGridMaskColumn;
dxDBGrid2Column4: TdxDBGridDateColumn;
dxDBGrid2Column5: TdxDBGridMaskColumn;
dxDBGrid2Column6: TdxDBGridMaskColumn;
dxDBGrid2Column7: TdxDBGridMaskColumn;
dxDBGrid2Column8: TdxDBGridMaskColumn;
dxDBGrid2Column10: TdxDBGridMaskColumn;
dxDBGrid2Column11: TdxDBGridMaskColumn;
dxDBGrid2Column12: TdxDBGridMaskColumn;
dxDBGrid2Column13: TdxDBGridDateColumn;
dxDBGrid2Column14: TdxDBGridDateColumn;
dxDBGrid2Column15: TdxDBGridMaskColumn;
dxDBGrid2Column16: TdxDBGridMaskColumn;
dxDBGrid2Column17: TdxDBGridMaskColumn;
dxDBGrid2Column18: TdxDBGridMaskColumn;
dxDBGrid2Column19: TdxDBGridMaskColumn;
dxDBGrid2Column20: TdxDBGridMaskColumn;
t_op_seae: TADOQuery;
bsSkinDBCheckRadioBox1: TbsSkinDBCheckRadioBox;
t_op_seae_vessel_bill: TADOQuery;
p_update: TADOStoredProc;
bsSkinDBCheckRadioBox2: TbsSkinDBCheckRadioBox;
procedure bsSkinButton7Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton11Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure t_op_seae_vesselBeforeEdit(DataSet: TDataSet);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure t_op_seae_vesselAfterInsert(DataSet: TDataSet);
procedure t_op_seae_vesselBeforePost(DataSet: TDataSet);
procedure bsSkinButton5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure t_op_seae_vesselAfterScroll(DataSet: TDataSet);
procedure FormShow(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinButton12Click(Sender: TObject);
procedure Panel2Resize(Sender: TObject);
procedure dxDBGrid2ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_op_seae_vessel_change: Tfrm_op_seae_vessel_change;
implementation
uses u_main, u_op_seae_vessel, my_sys_function;
{$R *.dfm}
procedure Tfrm_op_seae_vessel_change.bsSkinButton7Click(Sender: TObject);
begin
table_Prior(t_op_seae_vessel);
end;
procedure Tfrm_op_seae_vessel_change.bsSkinButton6Click(Sender: TObject);
begin
table_next(t_op_seae_vessel);
end;
procedure Tfrm_op_seae_vessel_change.bsSkinButton2Click(Sender: TObject);
begin
table_post(t_op_seae_vessel);
end;
procedure Tfrm_op_seae_vessel_change.bsSkinButton3Click(Sender: TObject);
begin
table_cancel(t_op_seae_vessel);
end;
procedure Tfrm_op_seae_vessel_change.bsSkinButton4Click(Sender: TObject);
begin
if t_op_seae_vessel.IsEmpty then
exit;
if t_op_seae_vessel.FieldByName('<27>Ƿ<EFBFBD><C7B7>޸<EFBFBD>').asboolean then
begin
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8><C4A3><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
table_delete(t_op_seae_vessel);
end;
procedure Tfrm_op_seae_vessel_change.bsSkinButton11Click(Sender: TObject);
begin
if bsSkinButton11.Caption='<27><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>' then
begin
Notebook1.PageIndex:=1;
bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
end
else
begin
Notebook1.PageIndex:=0;
bsSkinButton11.Caption:='<27><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>';
end;
end;
procedure Tfrm_op_seae_vessel_change.bsSkinButton1Click(Sender: TObject);
begin
t_op_seae_vessel.insert;
Notebook1.PageIndex:=1;
end;
procedure Tfrm_op_seae_vessel_change.t_op_seae_vesselBeforeEdit(
DataSet: TDataSet);
begin
if not modify_all then
begin
if t_op_seae_vessel.FieldByName('<27>Ƿ<EFBFBD><C7B7>޸<EFBFBD>').asboolean then
begin
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8><C4A3><EFBFBD>');
abort;
end;
end;
end;
procedure Tfrm_op_seae_vessel_change.Button1Click(Sender: TObject);
begin
if t_op_seae_vessel.IsEmpty then
exit;
if t_op_seae_vessel.FieldByName('<27>Ƿ<EFBFBD><C7B7>޸<EFBFBD>').asboolean then
exit;
try
frm_op_seae_vessel:=tfrm_op_seae_vessel.Create (self);
frm_op_seae_vessel.v_vessel_voyage.open;
frm_op_seae_vessel.wwIncrementalSearch1.Text:=wwDBLookupCombo49.text;
op_seae_vessel_num:=2;
frm_op_seae_vessel.ShowModal;
finally
frm_op_seae_vessel.Free;
frm_op_seae_vessel:=nil;
end;
end;
procedure Tfrm_op_seae_vessel_change.Button2Click(Sender: TObject);
begin
if t_op_seae_vessel.IsEmpty then
exit;
if t_op_seae_vessel.FieldByName('<27>Ƿ<EFBFBD><C7B7>޸<EFBFBD>').asboolean then
exit;
try
frm_op_seae_vessel:=tfrm_op_seae_vessel.Create (self);
frm_op_seae_vessel.v_vessel_voyage.open;
frm_op_seae_vessel.wwIncrementalSearch1.Text:=wwDBLookupCombo1.text;
op_seae_vessel_num:=3;
frm_op_seae_vessel.ShowModal;
finally
frm_op_seae_vessel.Free;
frm_op_seae_vessel:=nil;
end;
end;
procedure Tfrm_op_seae_vessel_change.t_op_seae_vesselAfterInsert(
DataSet: TDataSet);
begin
t_op_seae_vessel['<27>޸<EFBFBD><DEB8><EFBFBD>']:=employee;
t_op_seae_vessel['<27>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_op_seae_vessel['<27>Ƿ<EFBFBD><C7B7>޸<EFBFBD>']:=0;
end;
procedure Tfrm_op_seae_vessel_change.t_op_seae_vesselBeforePost(
DataSet: TDataSet);
begin
table_before_post(t_op_seae_vessel,'<27>ɴ<EFBFBD><C9B4><EFBFBD>');
table_before_post(t_op_seae_vessel,'<27>ɺ<EFBFBD><C9BA><EFBFBD>');
table_before_post(t_op_seae_vessel,'<27>ɿ<EFBFBD><C9BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
table_before_post(t_op_seae_vessel,'<27>´<EFBFBD><C2B4><EFBFBD>');
table_before_post(t_op_seae_vessel,'<27>º<EFBFBD><C2BA><EFBFBD>');
table_before_post(t_op_seae_vessel,'<27>¿<EFBFBD><C2BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure Tfrm_op_seae_vessel_change.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_op_seae_vessel_change.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_op_seae_vessel_change.Hide;
frm_op_seae_vessel_change.ManualFloat(frm_op_seae_vessel_change.BoundsRect );
frm_main.freeTabs('frm_op_seae_vessel_change');
action:=cafree;
frm_op_seae_vessel_change:=nil;
end;
procedure Tfrm_op_seae_vessel_change.t_op_seae_vesselAfterScroll(
DataSet: TDataSet);
begin
if t_op_seae_vessel.FieldByName('<27>Ƿ<EFBFBD><C7B7>޸<EFBFBD>').asboolean then
begin
v_vessel_change1.Enabled:=false;
v_vessel_change1.DataSet:=v_vessel_change;
v_vessel_change1.Enabled:=true;
bsSkinButton8.Enabled:=false;
bsSkinButton9.Enabled:=false;
bsSkinButton12.Enabled:=true;
end
else
begin
t_op_seae.close;
v_vessel_change1.Enabled:=false;
v_vessel_change1.DataSet:=t_op_seae;
v_vessel_change1.Enabled:=true;
bsSkinButton8.Enabled:=true;
bsSkinButton9.Enabled:=true;
bsSkinButton12.Enabled:=false;
end;
end;
procedure Tfrm_op_seae_vessel_change.FormShow(Sender: TObject);
begin
t_op_seae_vessel.open;
v_vessel_change.open;
t_op_seae_vessel_bill.open;
end;
procedure Tfrm_op_seae_vessel_change.bsSkinButton8Click(Sender: TObject);
begin
if t_op_seae_vessel.IsEmpty then
exit;
if (t_op_seae_vessel.State=dsinsert)or(t_op_seae_vessel.State=dsedit)then
t_op_seae_vessel.post;
t_op_seae.close;
t_op_seae.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').value:=wwDBLookupCombo49.text;
t_op_seae.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').value:=DBEdit63.text;
t_op_seae.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value:=wwDBDateTimePicker2.Date;
t_op_seae.open;
end;
procedure Tfrm_op_seae_vessel_change.bsSkinButton9Click(Sender: TObject);
begin
if not t_op_seae.Active then
exit;
if t_op_seae.IsEmpty then
exit;
if t_op_seae_vessel.IsEmpty then
exit;
if (t_op_seae_vessel.State=dsinsert)or(t_op_seae_vessel.State=dsedit)then
t_op_seae_vessel.post;
t_op_seae.first;
while not t_op_seae.eof do
begin
t_op_seae.edit;
t_op_seae['<27><><EFBFBD><EFBFBD>']:=t_op_seae_vessel['<27>´<EFBFBD><C2B4><EFBFBD>'];
t_op_seae['<27><><EFBFBD><EFBFBD>']:=t_op_seae_vessel['<27>º<EFBFBD><C2BA><EFBFBD>'];
t_op_seae['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_seae_vessel['<27>¿<EFBFBD><C2BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_op_seae['<27>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>']:=t_op_seae_vessel['<27>½ظ<C2BD><D8B8><EFBFBD><EFBFBD><EFBFBD>'];
if bsSkinDBCheckRadioBox2.Checked then begin
ins_op_seae_th('t_op_seae',t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring,true,false);
// t_op_seae['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=now;
t_op_seae['ί<>б<EFBFBD><D0B1><EFBFBD>']:=t_op_seae['ί<>б<EFBFBD><D0B1><EFBFBD>']+'T';
updatesaleorderwt(t_op_seae['<27><><EFBFBD><EFBFBD>'],t_op_seae['ί<>б<EFBFBD><D0B1><EFBFBD>'],1);
end;
t_op_seae.post;
t_op_seae_vessel_bill.insert;
t_op_seae_vessel_bill['VC_ID']:=t_op_seae_vessel['VC_ID'];
t_op_seae_vessel_bill['<27><><EFBFBD><EFBFBD>']:=t_op_seae['<27><><EFBFBD><EFBFBD>'];
t_op_seae_vessel_bill.post;
t_op_seae.next;
end;
t_op_seae_vessel.edit;
t_op_seae_vessel['<27>Ƿ<EFBFBD><C7B7>޸<EFBFBD>']:=1;
t_op_seae_vessel.post;
v_vessel_change.Requery();
v_vessel_change1.Enabled:=false;
v_vessel_change1.DataSet:=v_vessel_change;
v_vessel_change1.Enabled:=true;
bsSkinButton8.Enabled:=false;
bsSkinButton9.Enabled:=false;
bsSkinButton12.Enabled:=true;
end;
procedure Tfrm_op_seae_vessel_change.bsSkinButton12Click(Sender: TObject);
var
str:widestring;
begin
if t_op_seae_vessel.IsEmpty then
exit;
try
str:='declare @vessel varchar(60),@voyage varchar(20),@kaichuan smalldatetime,@jiegang smalldatetime '
+' select @vessel=t_op_seae_vessel.<2E>ɴ<EFBFBD><C9B4><EFBFBD>,@voyage=t_op_seae_vessel.<2E>ɺ<EFBFBD><C9BA><EFBFBD>, '
+' @kaichuan=t_op_seae_vessel.<2E>ɿ<EFBFBD><C9BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,@jiegang=t_op_seae_vessel.<2E>ɽظ<C9BD><D8B8><EFBFBD><EFBFBD><EFBFBD> '
+' from t_op_seae_vessel where t_op_seae_vessel.VC_ID='+t_op_seae_vessel.fieldbyname('VC_ID').asstring
+' update t_op_seae set <20><><EFBFBD><EFBFBD>=@vessel,<2C><><EFBFBD><EFBFBD>=@voyage,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=@kaichuan,<2C>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>=@jiegang '
+' where <20><><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD> from t_op_seae_vessel_bill where VC_ID='
+t_op_seae_vessel.fieldbyname('VC_ID').asstring+')'
+' delete t_op_seae_vessel_bill where VC_ID='+t_op_seae_vessel.fieldbyname('VC_ID').asstring;
p_update.Parameters.ParamByName('SQLStr').value:=str;
p_update.ExecProc;
modify_all:=true;
t_op_seae_vessel.edit;
t_op_seae_vessel['<27>Ƿ<EFBFBD><C7B7>޸<EFBFBD>']:=0;
t_op_seae_vessel.Post;
t_op_seae.close;
v_vessel_change1.Enabled:=false;
v_vessel_change1.DataSet:=t_op_seae;
v_vessel_change1.Enabled:=true;
bsSkinButton8.Enabled:=true;
bsSkinButton9.Enabled:=true;
bsSkinButton12.Enabled:=false;
finally
modify_all:=false;
end;
end;
procedure Tfrm_op_seae_vessel_change.Panel2Resize(Sender: TObject);
var
i:integer;
begin
i:=round(Panel2.Width/9);
bsSkinButton7.Width:=i;
bsSkinButton6.Width:=i;
bsSkinButton10.Width:=i;
bsSkinButton1.Width:=i;
bsSkinButton11.Width:=i;
bsSkinButton2.Width:=i;
bsSkinButton4.Width:=i;
bsSkinButton3.Width:=i;
end;
procedure Tfrm_op_seae_vessel_change.dxDBGrid2ColumnSorting(
Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort(Column,v_vessel_change,'ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
end.