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.

214 lines
6.5 KiB
Plaintext

unit u_op_vesselvoy_change;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, wwdbdatetimepicker, bsSkinCtrls, BusinessSkinForm, DB,ADODB,
Mask, DBCtrls, wwdblook, RxLookup;
type
Tfrm_op_vesselvoy_change = class(TForm)
Label1: TLabel;
bsBusinessSkinForm1: TbsBusinessSkinForm;
bsSkinButton1: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
DataSource1: TDataSource;
wwDBLookupCombo49: TwwDBLookupCombo;
Label125: TLabel;
Label126: TLabel;
Button1: TButton;
Label2: TLabel;
wwDBDateTimePicker2: TwwDBDateTimePicker;
DBEdit63: TEdit;
wwDBLookupCombo52: TwwDBLookupCombo;
Label124: TLabel;
Label145: TLabel;
wwDBLookupCombo17: TwwDBLookupCombo;
wwDBDateTimePicker17: TwwDBDateTimePicker;
Label197: TLabel;
Label25: TLabel;
wwDBDateTimePicker6: TwwDBDateTimePicker;
RxDBLookupCombo61: TRxDBLookupCombo;
Label3: TLabel;
Memo1: TMemo;
Label4: TLabel;
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
BSTYPE:string;
end;
var
frm_op_vesselvoy_change: Tfrm_op_vesselvoy_change;
implementation
uses my_sys_function, u_op_seae_vessel, u_op_seae, u_data_share;
{$R *.dfm}
procedure Tfrm_op_vesselvoy_change.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_op_vesselvoy_change.bsSkinButton1Click(Sender: TObject);
var
aQuery:TAdoQuery;
i:Integer;
book1:Tbookmark;
dsstr,PostUrl:string;
begin
{
if wwDBLookupCombo49.text='' then
begin
showmessage('请输入新的船名!!');
exit;
end;
if DBEdit63.text='' then
begin
showmessage('请输入新的航次!!');
exit;
end;
}
try
frm_op_seae.t_op_seae.DisableControls;
aQuery:=createAdoQuery;
try
with aQuery do begin
for i:=0 to frm_op_seae.dxDBGrid1.SelectedCount-1 do
begin
frm_op_seae.t_op_seae.GotoBookmark(pointer(frm_op_seae.dxDBGrid1.selectedrows[i]));
// Close;sql.Clear;
frm_op_seae.t_op_seae.Edit;
if (frm_op_seae.t_op_seae.FieldByName('费用状态').AsString<>'费用封帐') then begin
if (wwDBDateTimePicker2.Text<>'') then begin
frm_op_seae.t_op_seae['开船日期']:=FormatDateTime('YYYY-MM-DD',wwDBDateTimePicker2.Date);
frm_op_seae.t_op_seae['会计期间']:=FormatDateTime('YYYY-MM-DD',wwDBDateTimePicker2.Date);
end;
if (trim(wwDBLookupCombo49.Text)<>'') then begin
frm_op_seae.t_op_seae['船名']:=wwDBLookupCombo49.Text;
end;
if (trim(DBEdit63.text)<>'') then begin
frm_op_seae.t_op_seae['航次']:=DBEdit63.text;
end;
if (trim(RxDBLookupCombo61.DisplayValue)<>'') then begin
frm_op_seae.t_op_seae['船代']:=RxDBLookupCombo61.DisplayValue;
end;
if (trim(Memo1.text)<>'') then begin
frm_op_seae.t_op_seae['销售订舱说明']:=Memo1.text;
end;
if (trim(wwDBLookupCombo52.Text)<>'') then begin
frm_op_seae.t_op_seae['卸货港']:=wwDBLookupCombo52.Text;
if frm_data_share.t_code_disport.Locate('英文名',wwDBLookupCombo52.text,[]) then
begin
frm_op_seae.t_op_seae['卸货代码']:=frm_data_share.t_code_disport['EDI代码'];
end else begin
frm_op_seae.t_op_seae['卸货代码']:='';
end;
end;
if (trim(wwDBLookupCombo17.Text)<>'') then begin
frm_op_seae.t_op_seae['目的地']:=wwDBLookupCombo17.Text;
if frm_data_share.t_code_disport.Locate('英文名',wwDBLookupCombo17.text,[]) then
begin
frm_op_seae.t_op_seae['目的地代码']:=frm_data_share.t_code_disport['EDI代码'];
end else begin
frm_op_seae.t_op_seae['目的地代码']:='';
end;
end;
if (trim(wwDBDateTimePicker6.Text)<>'') then begin
frm_op_seae.t_op_seae['截单日期']:=wwDBDateTimePicker6.Text;
end;
if (trim(wwDBDateTimePicker17.Text)<>'') then begin
frm_op_seae.t_op_seae['截港日期']:=wwDBDateTimePicker17.Text;
end;
end;
frm_op_seae.t_op_seae.Post;
Close;sql.Clear;
sql.Add('Update t_op_seae_assistant set 主编号=主编号');
if (wwDBDateTimePicker2.Text<>'') then begin
sql.Add(',开船日期=:开船日期');
end;
if (trim(wwDBLookupCombo49.Text)<>'') then begin
sql.Add(',船名=:vsl');
end;
if (trim(DBEdit63.text)<>'') then begin
sql.Add(',航次=:voy');
end;
if (trim(wwDBLookupCombo52.Text)<>'') then begin
sql.Add(',卸货港=:portdischarge');
end;
if (trim(wwDBLookupCombo17.Text)<>'') then begin
sql.Add(',目的地=:destination');
end;
sql.Add(' where 编号='''+frm_op_seae.t_op_seae.fieldbyname('编号').AsString+'''');
if (trim(wwDBLookupCombo49.Text)<>'') then begin
Parameters.ParamByName('vsl').Value:=wwDBLookupCombo49.Text;
end;
if (trim(DBEdit63.text)<>'') then begin
Parameters.ParamByName('voy').Value:=DBEdit63.text;
end;
if (wwDBDateTimePicker2.Text<>'') then begin
Parameters.ParamByName('开船日期').Value:=FormatDateTime('YYYY-MM-DD',wwDBDateTimePicker2.Date);
end;
if (trim(wwDBLookupCombo52.Text)<>'') then begin
Parameters.ParamByName('portdischarge').Value:=wwDBLookupCombo52.Text;
end;
if (trim(wwDBLookupCombo17.Text)<>'') then begin
Parameters.ParamByName('destination').Value:=wwDBLookupCombo17.Text;
end;
ExecSQL;
end;
end;
finally
FreeAndNil(aQuery);
end;
finally
frm_op_seae.t_op_seae.EnableControls;
end;
book1:=frm_op_seae.t_op_seae.GetBookmark;
frm_op_seae.t_op_seae.Refresh;
frm_op_seae.t_op_seae.GotoBookmark(book1);
showmessage('更改成功!!');
close;
end;
procedure Tfrm_op_vesselvoy_change.Button1Click(Sender: TObject);
begin
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:=4;
frm_op_seae_vessel.ShowModal;
finally
frm_op_seae_vessel.Free;
frm_op_seae_vessel:=nil;
end;
end;
end.