📄 frm_goodsstatedit.pas
字号:
unit Frm_GoodsStatEdit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Frm_Cargo, XPMenu, StdCtrls, Buttons, ExtCtrls, ComCtrls,DB,
ADODB;
type
TFrmGoodsStatEdit = class(TFrmCargo)
Label41: TLabel;
Label59: TLabel;
Label68: TLabel;
Label70: TLabel;
Label71: TLabel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
SpeedButton1: TSpeedButton;
EdtFileNO: TEdit;
EdtRemark: TEdit;
StatDate: TDateTimePicker;
Panel1: TPanel;
BtnCancel: TBitBtn;
BtnOK: TBitBtn;
EdtMark: TComboBox;
ComTransStat: TMemo;
Memvoyage: TMemo;
ComHcInfo: TComboBox;
EdtVoyage: TEdit;
VoyageDate: TDateTimePicker;
QryTemp: TADOQuery;
procedure FormActivate(Sender: TObject);
procedure BtnOKClick(Sender: TObject);
procedure BtnCancelClick(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
IsEdit:Boolean;
{ Public declarations }
end;
var
FrmGoodsStatEdit: TFrmGoodsStatEdit;
implementation
uses frm_goodsstat, Frm_Main;
{$R *.dfm}
procedure TFrmGoodsStatEdit.FormActivate(Sender: TObject);
var
Fss:Tlocateoptions;
begin
inherited;
shortDateFormat := 'yyyy-mm-dd';
statdate.date:=date;
voyagedate.date:=date;
if isedit then
begin
with QryTemp do
begin
close;
sql.text:='select * from truststate where goodsstat ='''+frmgoodsstat.varcode+'''';
open;
end;
if QryTemp.recordcount>0 then
begin
// edtFileno.text:=frmgoodsstat.LV.Selected.SubItems.strings[0];
edtFileno.text:=QryTemp.fieldbyname('filecode').asstring;
comhcinfo.text:=QryTemp.fieldbyname('hcinfo').asstring;
edtvoyage.text:=QryTemp.fieldbyname('voyage').asstring;
voyagedate.date:=strtodatetime(QryTemp.fieldbyname('voyagedate').asstring);
comtransstat.text:=QryTemp.fieldbyname('Transstate').asstring;
StatDate.date:=strtodatetime(QryTemp.fieldbyname('statedate').asstring);
//Memvoyage
Memvoyage.lines.text:=QryTemp.fieldbyname('voyageship').asstring;
EdtRemark.text:=QryTemp.fieldbyname('remark').asstring;
edtmark.text:=QryTemp.fieldbyname('synsign').asstring;
end;
end
else
begin
if frmgoodsstat.Multi then
edtfileno.text:=frmgoodsstat.TrustGroup.Text
else
edtFileno.text:=frmgoodsstat.lv.selected.caption; //frmgoodsstat.hawbno;
end;
end;
procedure TFrmGoodsStatEdit.BtnOKClick(Sender: TObject);
var
MyItems:Tlistitem;
ValueArray:Array[0..20] of string;
ArrayCount:integer;
SqlStr:String;
Codeget:string;
I:Integer;
begin
inherited;
If edtmark.text='' then
begin
ShowMessage('状态标记不能为空,请选择输入,请检查!');
exit;
end;
if IsEdit then
begin
try
SqlStr:='';
FrmMain.UpStr(sqlstr,'TrustState');
FrmMain.UpStr(sqlstr,'filecode',edtfileno.text,',');
FrmMain.UpStr(sqlstr,'hcinfo',comhcinfo.text,',');
FrmMain.UpStr(sqlstr,'voyage',edtvoyage.text,',');
FrmMain.UpStr(sqlstr,'voyagedate',datetimetostr(int(voyagedate.date)),',');
FrmMain.UpStr(sqlstr,'transstate',trim(comtransstat.Lines.text),',');
FrmMain.UpStr(sqlstr,'statedate',datetimetostr(int(statdate.date)),',');
FrmMain.UpStr(sqlstr,'remark',trim(edtremark.text),',');
FrmMain.UpStr(sqlstr,'voyageShip',trim(Memvoyage.Lines.text),',');
FrmMain.UpStr(sqlstr,'synsign',edtmark.text,'');
FrmMain.UpStr(sqlstr,'goodsstat =',frmgoodsstat.varcode,'w');
if FrmMain.execsql(sqlstr) then
else
begin
ShowMessage('操作失误,记录未保存,请检查');
exit;
end;
{状态编号 航程信息,航班,航班日期,状态描述,运输情况 记录日期}
ValueArray[0]:=Frmgoodsstat.varcode;
ValueArray[1]:=comhcinfo.text;
ValueArray[2]:=Edtvoyage.text;
ValueArray[3]:=datetimetostr(int(voyagedate.date));
ValueArray[4]:=EdtMark.text;
ValueArray[5]:=ComTransStat.lines.text;
ValueArray[6]:=datetimetostr(int(statdate.date));
ArrayCount:=6;
FrmMain.RefeshOne(ValueArray,ArrayCount,frmGoodsStat.lv2);
close;
except
ShowMessage('操作有失误,请检查!');
end;
end
else
begin
try
if frmgoodsstat.Multi then
begin
for i:=0 to frmgoodsstat.LV.SelCount-1 do
begin
codeget:=FrmMain.getcode('S');
SqlStr:='insert into truststate(goodsstat,filecode,'+
'hcinfo,voyage,voyagedate,transstate,statedate,'+
'voyageShip,remark,synsign) values(';
FrmMain.InsStr(sqlstr,CODEGET,',');
FrmMain.InsStr(sqlstr,frmgoodsstat.trustgroup.strings[i],',');
FrmMain.InsStr(sqlstr,comhcinfo.text,',');
FrmMain.InsStr(sqlstr,edtvoyage.text,',');
FrmMain.InsStr(sqlstr,datetimetostr(int(voyagedate.date)),',');
FrmMain.InsStr(sqlstr,trim(comtransstat.Lines.text),',');
FrmMain.InsStr(sqlstr,datetimetostr(int(statdate.date)),',');
FrmMain.InsStr(sqlstr,trim(Memvoyage.Lines.text),',');
FrmMain.InsStr(sqlstr,edtremark.text,',');
FrmMain.InsStr(sqlstr,edtmark.text,'');
if FrmMain.ExecSQL(sqlstr) then
else
begin
ShowMessage('操作失误,记录未保存,请检查');
exit;
end;
end;
end
else
begin
codeget:=FrmMain.getcode('S');
SqlStr:='insert into truststate(goodsstat,filecode,'+
'hcinfo,voyage,voyagedate,transstate,statedate,'+
'voyageShip,remark,synsign) values(';
FrmMain.InsStr(sqlstr,CODEGET,',');
FrmMain.InsStr(sqlstr,edtfileno.text,',');
FrmMain.InsStr(sqlstr,comhcinfo.text,',');
FrmMain.InsStr(sqlstr,edtvoyage.text,',');
FrmMain.InsStr(sqlstr,datetimetostr(int(voyagedate.date)),',');
FrmMain.InsStr(sqlstr,trim(comtransstat.Lines.text),',');
FrmMain.InsStr(sqlstr,datetimetostr(int(statdate.date)),',');
FrmMain.InsStr(sqlstr,trim(Memvoyage.Lines.text),',');
FrmMain.InsStr(sqlstr,edtremark.text,',');
FrmMain.InsStr(sqlstr,edtmark.text,'');
if FrmMain.ExecSQL(sqlstr) then
else
begin
ShowMessage('操作失误,记录未保存,请检查');
exit;
end;
ValueArray[0]:=codeget;
ValueArray[1]:=comhcinfo.text;
ValueArray[2]:=Edtvoyage.text;
ValueArray[3]:=datetimetostr(int(voyagedate.date));
ValueArray[4]:=EdtMark.text;
ValueArray[5]:=ComTransStat.lines.text;
ValueArray[6]:=datetimetostr(int(statdate.date));
ArrayCount:=6;
FrmMain.AddListView(ValueArray,ArrayCount,Frmgoodsstat.lv2);
end;
except
ShowMessage('操作有失误,请检查!');
end;
end;
close;
end;
procedure TFrmGoodsStatEdit.BtnCancelClick(Sender: TObject);
begin
inherited;
Close;
end;
procedure TFrmGoodsStatEdit.SpeedButton1Click(Sender: TObject);
var
stemp:string;
FileCode:String;
begin
inherited;
if frmgoodsstat.multi then
filecode:=frmgoodsstat.TrustGroup.Strings[0]
else
filecode:=edtfileno.Text;
if comhcinfo.text='一程信息' then
begin
stemp:=FrmMain.GetCustomerValue('filecode',filecode,'by1','filetable');
edtvoyage.text:=stemp;
stemp:=FrmMain.GetCustomerValue('filecode',filecode,'fdate1','filetable');
voyagedate.date:=strtodatetime(stemp);
end;
if comhcinfo.text='二程信息' then
begin
stemp:=FrmMain.GetCustomerValue('filecode',filecode,'by2','filetable');
edtvoyage.text:=stemp;
stemp:=FrmMain.GetCustomerValue('filecode',filecode,'fdate2','filetable');
voyagedate.date:=strtodatetime(stemp);
end;
if comhcinfo.text='三程信息' then
begin
stemp:=FrmMain.GetCustomerValue('filecode',filecode,'by3','filetable');
edtvoyage.text:=stemp;
stemp:=FrmMain.GetCustomerValue('filecode',filecode,'fdate3','filetable');
voyagedate.date:=strtodatetime(stemp);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -