774 lines
21 KiB
ObjectPascal
774 lines
21 KiB
ObjectPascal
|
|
unit U_YX_WorkGSLR;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
|||
|
|
cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView,
|
|||
|
|
cxGridTableView, cxGridDBTableView, cxClasses, cxControls,
|
|||
|
|
cxGridCustomView, cxGrid, cxMemo, cxRichEdit, ComCtrls, cxContainer,
|
|||
|
|
cxTextEdit, cxMaskEdit, cxButtonEdit, StdCtrls, ToolWin, DBClient, ADODB,
|
|||
|
|
ExtCtrls, BtnEdit, cxCalendar,StrUtils, cxCurrencyEdit,
|
|||
|
|
cxGridCustomPopupMenu, cxGridPopupMenu, cxDropDownEdit, cxGroupBox,
|
|||
|
|
cxCheckBox, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
|
|||
|
|
IdFTP, ImgList, Menus,ShellAPI;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmYX_WorkGSLR = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBSave: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
ScrollBox1: TScrollBox;
|
|||
|
|
ADOTemp: TADOQuery;
|
|||
|
|
ADOCmd: TADOQuery;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
Order_Sub: TClientDataSet;
|
|||
|
|
ADOQuery1: TADOQuery;
|
|||
|
|
CDS_CON: TClientDataSet;
|
|||
|
|
DSCON: TDataSource;
|
|||
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryTmp: TADOQuery;
|
|||
|
|
ADOQuery2: TADOQuery;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
Panel21: TPanel;
|
|||
|
|
Label52: TLabel;
|
|||
|
|
RZBiaoTi: TEdit;
|
|||
|
|
Label51: TLabel;
|
|||
|
|
Label7: TLabel;
|
|||
|
|
ListView1: TListView;
|
|||
|
|
Panel12: TPanel;
|
|||
|
|
Label48: TLabel;
|
|||
|
|
Button4: TButton;
|
|||
|
|
Panel13: TPanel;
|
|||
|
|
Image1: TImage;
|
|||
|
|
WJName: TEdit;
|
|||
|
|
Button7: TButton;
|
|||
|
|
WJPach: TEdit;
|
|||
|
|
Button8: TButton;
|
|||
|
|
Panel2: TPanel;
|
|||
|
|
PopupMenu2: TPopupMenu;
|
|||
|
|
MenuItem1: TMenuItem;
|
|||
|
|
N3: TMenuItem;
|
|||
|
|
MenuItem2: TMenuItem;
|
|||
|
|
N4: TMenuItem;
|
|||
|
|
ImageList1: TImageList;
|
|||
|
|
IdFTP1: TIdFTP;
|
|||
|
|
ODPat: TOpenDialog;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
RZDate: TDateTimePicker;
|
|||
|
|
RZNote: TEdit;
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure TBSaveClick(Sender: TObject);
|
|||
|
|
procedure v1PRTColorPropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
procedure v1OrderUnitPropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
procedure Image1Click(Sender: TObject);
|
|||
|
|
procedure MenuItem1Click(Sender: TObject);
|
|||
|
|
procedure N3Click(Sender: TObject);
|
|||
|
|
procedure MenuItem2Click(Sender: TObject);
|
|||
|
|
procedure N4Click(Sender: TObject);
|
|||
|
|
procedure Button8Click(Sender: TObject);
|
|||
|
|
procedure Button4Click(Sender: TObject);
|
|||
|
|
procedure Button7Click(Sender: TObject);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure ListView1DblClick(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
lstPat:TStringList;
|
|||
|
|
procedure InitData();
|
|||
|
|
function SaveData():Boolean;
|
|||
|
|
function getOrderNo(fconNo:string):string;
|
|||
|
|
procedure CFSaveData();
|
|||
|
|
procedure Initimage();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
PState,CopyInt,PriceFlag:Integer;
|
|||
|
|
FMainId,FFMainId,FOrderNo:String;
|
|||
|
|
FXS:Integer;
|
|||
|
|
canshu1,canshu2:string;
|
|||
|
|
fFlileFlag:string;
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmYX_WorkGSLR: TfrmYX_WorkGSLR;
|
|||
|
|
newh:hwnd;
|
|||
|
|
implementation
|
|||
|
|
uses
|
|||
|
|
U_DataLink,U_ZDYHelp,U_Fun,U_ZDYHelpSel, U_ZdyAttachment, U_ZdyAttachGYS,
|
|||
|
|
U_CPManageSel, getpic, U_ZdyAttachCP_HX_sel,U_ContractList_CX;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
procedure TfrmYX_WorkGSLR.CFSaveData();
|
|||
|
|
var
|
|||
|
|
fCFID:string;
|
|||
|
|
begin
|
|||
|
|
with ADOQuery2 do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from JYOrder_Sub_CF where subID='''+Trim(Order_Sub.fieldbyname('subID').asstring)+'''');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
if ADOQuery2.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
with ADOQuery1 do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
SQL.Add('select A.CengJI,A.MLName,A.MLSeHao,A.MLID ');
|
|||
|
|
sql.Add(',HXNo=(select Top 1 B.HXNo from CP_YDang_JG B where B.CengJi=A.CengJi and B.CYID=A.CYID and B.IFZY=1)');
|
|||
|
|
sql.Add(',GYDM=(select Top 1 B.GYDM from CP_YDang_JG B where B.CengJi=A.CengJi and B.CYID=A.CYID and B.IFZY=1)');
|
|||
|
|
sql.Add(' from CP_YDang_ML A ');
|
|||
|
|
SQL.Add('where A.CYID='''+trim(Order_Sub.fieldbyname('PRTCode').AsString)+'''');
|
|||
|
|
sql.Add(' and A.IFSel=1 ');
|
|||
|
|
sql.Add(' order by A.Cengji,A.MLID');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
while not ADOQuery1.Eof do
|
|||
|
|
begin
|
|||
|
|
IF GetLSNo(ADOQueryCmd,fCFID,'JC','JYOrder_Sub_CF',4,1)=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from JYOrder_Sub_CF where CFID='''+Trim(fCFID)+'''');
|
|||
|
|
Open;
|
|||
|
|
IF IsEmpty then Append
|
|||
|
|
else edit;
|
|||
|
|
fieldbyname('CFID').Value:=trim(fCFID);
|
|||
|
|
fieldbyname('PRTCode').Value:=trim(Order_Sub.fieldbyname('PRTCode').AsString);
|
|||
|
|
fieldbyname('PrtCodeName').Value:=trim(ADOQuery1.fieldbyname('MLName').AsString);
|
|||
|
|
fieldbyname('PrtSpec').Value:=trim(Order_Sub.fieldbyname('PrtSpec').AsString);
|
|||
|
|
fieldbyname('SOrddefstr1').Value:=trim(ADOQuery1.fieldbyname('MLSeHao').AsString);
|
|||
|
|
fieldbyname('PRTColor').Value:=trim(ADOQuery1.fieldbyname('MLColor').AsString);
|
|||
|
|
fieldbyname('PRTHX').Value:=trim(ADOQuery1.fieldbyname('HXName').AsString);
|
|||
|
|
fieldbyname('PRTOrderRollNum').Value:=Order_Sub.fieldbyname('PRTOrderRollNum').AsFloat;
|
|||
|
|
fieldbyname('PrtOrderQty').Value:=Order_Sub.fieldbyname('PRTOrderQty').AsFloat;
|
|||
|
|
fieldbyname('OrderUnit').Value:=trim(Order_Sub.fieldbyname('OrderUnit').AsString);
|
|||
|
|
FieldByName('PRTType').Value:=trim(ADOQuery1.fieldbyname('CengJi').AsString)+'<27><>';
|
|||
|
|
fieldbyname('MainID').Value:=trim(Order_Sub.fieldbyname('MainID').AsString);
|
|||
|
|
fieldbyname('SubID').Value:=trim(Order_Sub.fieldbyname('SubID').AsString);
|
|||
|
|
post;
|
|||
|
|
end;
|
|||
|
|
ADOQuery1.Next;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
with ADOQuery1 do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update JYOrder_Sub_CF set ');
|
|||
|
|
sql.Add('PRTCode='''+trim(Order_Sub.fieldbyname('PRTCode').AsString)+'''');
|
|||
|
|
sql.Add(',PrtSpec='''+trim(Order_Sub.fieldbyname('PrtSpec').AsString)+'''');
|
|||
|
|
{if Order_Sub.fieldbyname('PRTOrderRollNum').AsFloat=0 then
|
|||
|
|
sql.Add(',PRTOrderRollNum=0')
|
|||
|
|
else
|
|||
|
|
sql.Add(',PRTOrderRollNum='''+trim(Order_Sub.fieldbyname('PRTOrderRollNum').AsString)+'''');
|
|||
|
|
if Order_Sub.fieldbyname('PrtOrderQty').AsFloat=0 then
|
|||
|
|
sql.Add(',PrtOrderQty=0')
|
|||
|
|
else
|
|||
|
|
sql.Add(',PrtOrderQty='''+trim(Order_Sub.fieldbyname('PrtOrderQty').AsString)+'''');}
|
|||
|
|
sql.Add(',OrderUnit='''+trim(Order_Sub.fieldbyname('OrderUnit').AsString)+'''');
|
|||
|
|
sql.Add(' where Subid='''+trim(Order_Sub.fieldbyname('Subid').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmYX_WorkGSLR.getOrderNo(fconNo:string):string;
|
|||
|
|
var
|
|||
|
|
str1:string;
|
|||
|
|
i:integer;
|
|||
|
|
begin
|
|||
|
|
str1:=trim(fconNo)+'01';
|
|||
|
|
with ADOTemp do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select MainID from JYOrder_Main where orderNo='+quotedstr(trim(str1)));
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
IF not ADOTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
for i:=1 to 99 do
|
|||
|
|
begin
|
|||
|
|
str1:=trim(fconNo)+rightstr(inttostr(100+i),2);
|
|||
|
|
with ADOCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select MainID from JYOrder_Main where orderNo='+quotedstr(trim(str1)));
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
IF ADOCmd.IsEmpty then break;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
result:=str1;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.InitData();
|
|||
|
|
begin
|
|||
|
|
with ADOQuery1 do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add(' select * from YX_WorkRZ where RZID='''+trim(FMainid)+''' ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCSHDataNew(ADOQuery1,ScrollBox1,2);
|
|||
|
|
RZDate.DateTime:=ADOQuery1.fieldbyname('RZDate').AsDateTime;
|
|||
|
|
if PState=0 then
|
|||
|
|
begin
|
|||
|
|
RZDate.DateTime:=SGetServerDateTime(ADOTemp);
|
|||
|
|
//RZRenWu.Text:=Trim(DName);
|
|||
|
|
end;
|
|||
|
|
Initimage();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitData();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.Initimage();
|
|||
|
|
var
|
|||
|
|
ListItem: TListItem;
|
|||
|
|
Flag: Cardinal;
|
|||
|
|
info: SHFILEINFOA;
|
|||
|
|
Icon: TIcon;
|
|||
|
|
begin
|
|||
|
|
ListView1.Items.Clear;
|
|||
|
|
with adoqueryTemp do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select fileName from TP_File ');
|
|||
|
|
sql.Add('where WBID='''+trim(FMainid)+''' ');
|
|||
|
|
sql.Add('and TFType=''<27><>˾''');
|
|||
|
|
open;
|
|||
|
|
if not IsEmpty then
|
|||
|
|
begin
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
with ListView1 do
|
|||
|
|
begin
|
|||
|
|
LargeImages := ImageList1;
|
|||
|
|
Icon := TIcon.Create;
|
|||
|
|
ListItem := Items.Add;
|
|||
|
|
Listitem.Caption := trim(fieldbyname('fileName').AsString);
|
|||
|
|
Flag := (SHGFI_LARGEICON or SHGFI_ICON or SHGFI_USEFILEATTRIBUTES);
|
|||
|
|
SHGetFileInfo(Pchar(trim(fieldbyname('fileName').AsString)), 0, info, Sizeof(info), Flag);
|
|||
|
|
Icon.Handle := info.hIcon;
|
|||
|
|
ImageList1.AddIcon(Icon);
|
|||
|
|
ListItem.ImageIndex := ImageList1.Count - 1;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmYX_WorkGSLR.SaveData():Boolean;
|
|||
|
|
var
|
|||
|
|
maxno,forderNo:String;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOCmd.Connection.BeginTrans;
|
|||
|
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if Trim(FMainId)='' then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOCmd,maxno,'RZ','YX_WorkRZ',3,1)=False then
|
|||
|
|
begin
|
|||
|
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
maxno:=Trim(FMainId);
|
|||
|
|
end;
|
|||
|
|
with ADOCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
SQL.Add('select * from YX_WorkRZ where RZID='''+Trim(maxno)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOCmd do
|
|||
|
|
begin
|
|||
|
|
if isempty then
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('Filler').Value:=Trim(DName);
|
|||
|
|
end
|
|||
|
|
else begin
|
|||
|
|
Edit;
|
|||
|
|
end;
|
|||
|
|
FieldByName('RZID').Value:=Trim(maxno);
|
|||
|
|
SSetsaveSqlNew(ADOCmd,'YX_WorkRZ',ScrollBox1,2);
|
|||
|
|
FieldByName('RZDate').AsDateTime:=RZDate.Date;
|
|||
|
|
FieldByName('SCType').Value:='<27><>˾';
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
FMainId:=Trim(maxno);
|
|||
|
|
ADOCmd.Connection.CommitTrans;
|
|||
|
|
Result:=True;
|
|||
|
|
except
|
|||
|
|
Result:=False;
|
|||
|
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.TBSaveClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
RZDate.SetFocus;
|
|||
|
|
if SaveData() then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
|
|||
|
|
ModalResult:=1;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.v1PRTColorPropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag:='OrdColor';
|
|||
|
|
flagname:='<27><>ɫ';
|
|||
|
|
V1Name.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
V1Note.Caption:='Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
fnote:=True;
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
Self.Order_Sub.Edit;
|
|||
|
|
Self.Order_Sub.FieldByName('MLColor').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
Self.Order_Sub.FieldByName('MLColorNo').Value:=Trim(ClientDataSet1.fieldbyname('Note').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.v1OrderUnitPropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
var
|
|||
|
|
mvalues:string;
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.Image1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Panel12.Visible:=false;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.MenuItem1Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
OpenDiaLog: TOpenDialog;
|
|||
|
|
fFileName:string;
|
|||
|
|
fFilePath:string;
|
|||
|
|
begin
|
|||
|
|
if FMainId='' then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOCmd,FMainId,'','YX_WorkRZ',3,1)=False then
|
|||
|
|
begin
|
|||
|
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
OpenDiaLog := TOpenDialog.Create(Self);
|
|||
|
|
if OpenDiaLog.Execute then
|
|||
|
|
begin
|
|||
|
|
fFilePath:=OpenDiaLog.FileName;
|
|||
|
|
fFileName:=ExtractFileName(OpenDiaLog.FileName);
|
|||
|
|
Panel12.Visible:=True;
|
|||
|
|
WJName.Text:=Trim(fFileName);
|
|||
|
|
WJName.Hint:=Trim(fFileName);
|
|||
|
|
WJPach.Text:=fFilePath;
|
|||
|
|
Button8.Visible:=False;
|
|||
|
|
Button4.Visible:=True;
|
|||
|
|
Button7.Visible:=True;
|
|||
|
|
Panel12.Refresh;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.N3Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fFileName:string;
|
|||
|
|
begin
|
|||
|
|
if listView1.SelCount<1 then exit;
|
|||
|
|
if Trim(DParameters1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
|
begin
|
|||
|
|
if now-RZDate.DateTime>1 then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>Ȩ<EFBFBD><EFBFBD><DEB3><EFBFBD>һ<EFBFBD>첻<EFBFBD><ECB2BB>ɾ<EFBFBD><C9BE>','<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
fFileName:=ListView1.Selected.Caption;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete from TP_File ');
|
|||
|
|
sql.Add('where WBID='''+trim(FMainid)+'''');
|
|||
|
|
sql.Add('and TFType=''<27><>˾''');
|
|||
|
|
sql.Add('and FileName='+quotedstr(trim(fFileName)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
Initimage();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.MenuItem2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if listView1.SelCount<1 then exit;
|
|||
|
|
Panel12.Visible:=True;
|
|||
|
|
Button4.Visible:=False;
|
|||
|
|
Button7.Visible:=False;
|
|||
|
|
Button8.Visible:=True;
|
|||
|
|
Panel12.Refresh;
|
|||
|
|
WJName.Text:=Trim(ListView1.Selected.Caption);
|
|||
|
|
WJName.Hint:=Trim(ListView1.Selected.Caption);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.N4Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
SaveDialog: TSaveDialog;
|
|||
|
|
fFileName:string;
|
|||
|
|
fFilePath:string;
|
|||
|
|
begin
|
|||
|
|
if listView1.SelCount<1 then exit;
|
|||
|
|
try
|
|||
|
|
fFileName:=ListView1.Selected.Caption;
|
|||
|
|
SaveDialog := TSaveDialog.Create(Self);
|
|||
|
|
SaveDialog.FileName:=fFileName;
|
|||
|
|
if SaveDialog.Execute then
|
|||
|
|
begin
|
|||
|
|
Panel2.Caption:='<27><><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>Ե<EFBFBD>...';
|
|||
|
|
Panel2.Visible:=true;
|
|||
|
|
application.ProcessMessages;
|
|||
|
|
fFilePath:=SaveDialog.FileName;
|
|||
|
|
try
|
|||
|
|
IdFTP1.Host := ReadINIFileStr('SYSTEMSET.INI','SERVER','FTP<54><50>ַ','127.0.0.1');;
|
|||
|
|
IdFTP1.Username := 'three';
|
|||
|
|
IdFTP1.Password := '641010';
|
|||
|
|
IdFTP1.Connect();
|
|||
|
|
except
|
|||
|
|
;
|
|||
|
|
end;
|
|||
|
|
if IdFTP1.Connected then
|
|||
|
|
begin
|
|||
|
|
Panel2.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>Ե<EFBFBD>...';
|
|||
|
|
Panel2.Visible:=true;
|
|||
|
|
application.ProcessMessages;
|
|||
|
|
try
|
|||
|
|
IdFTP1.Get('FJ\'+ Trim(fFileName), fFilePath,false, true);
|
|||
|
|
except
|
|||
|
|
Panel2.Visible:=false;
|
|||
|
|
Application.MessageBox('<27>ͻ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
|
|||
|
|
IdFTP1.Quit;
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
Panel2.Visible:=false;
|
|||
|
|
Application.MessageBox('<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
|
|||
|
|
IdFTP1.Quit;
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
Panel2.Visible:=false;
|
|||
|
|
if IdFTP1.Connected then IdFTP1.Quit;
|
|||
|
|
end;
|
|||
|
|
except
|
|||
|
|
Panel2.Visible:=false;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.Button8Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fFileName:String;
|
|||
|
|
begin
|
|||
|
|
fFileName:=WJName.Hint;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate TP_File Set FileName='''+Trim(WJName.Text)+'''');
|
|||
|
|
sql.Add('where WBID='''+trim(FMainid)+'''');
|
|||
|
|
sql.Add('and TFType=''<27><>˾''');
|
|||
|
|
sql.Add('and FileName='+quotedstr(trim(fFileName)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
Panel12.Visible:=False;
|
|||
|
|
Initimage();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.Button4Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fFileName:string;
|
|||
|
|
fFilePath:string;
|
|||
|
|
maxNo:string;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
adoqueryCmd.Connection.BeginTrans;
|
|||
|
|
begin
|
|||
|
|
fFilePath:=WJPach.Text;
|
|||
|
|
fFileName:=WJName.Text;
|
|||
|
|
with adoqueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select TFId from TP_File ');
|
|||
|
|
sql.Add('where WBID='''+trim(FMainId)+'''');
|
|||
|
|
sql.Add(' and TFType=''<27><>˾''');
|
|||
|
|
sql.Add(' and FileName='+quotedstr(trim(fFileName)));
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
IF ADOQueryCmd.IsEmpty=False then
|
|||
|
|
begin
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox('<27>˸<EFBFBD><CBB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD><D1B4>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><DEB8>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONERROR);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
Panel12.Visible:=False;
|
|||
|
|
Panel2.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>Ե<EFBFBD>...';
|
|||
|
|
Panel2.Visible:=true;
|
|||
|
|
application.ProcessMessages;
|
|||
|
|
|
|||
|
|
if GetLSNo(ADOQueryCmd,maxNo,'RZ','TP_File',4,1)=False then
|
|||
|
|
begin
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
{with adoqueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete from TP_File ');
|
|||
|
|
sql.Add('where WBID='''+trim(FMainid)+'''');
|
|||
|
|
sql.Add(' and TFType=''<27><>˾''');
|
|||
|
|
sql.Add(' and FileName='+quotedstr(trim(fFileName)));
|
|||
|
|
execsql;
|
|||
|
|
end;}
|
|||
|
|
with adoqueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from TP_File ');
|
|||
|
|
sql.Add('where WBID='''+trim(FMainid)+''' ');
|
|||
|
|
sql.Add(' and TFType=''<27><>˾''');
|
|||
|
|
sql.Add(' and FileName='+quotedstr(trim(fFileName)));
|
|||
|
|
open;
|
|||
|
|
append;
|
|||
|
|
fieldbyname('TFID').Value:=trim(maxNO);
|
|||
|
|
fieldbyname('WBID').Value:=trim(FMainId);
|
|||
|
|
fieldbyname('TFType').Value:='<27><>˾';
|
|||
|
|
fieldbyname('FileName').Value:=trim(fFileName);
|
|||
|
|
post;
|
|||
|
|
end;
|
|||
|
|
if fFilePath <> '' then
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
IdFTP1.Host := ReadINIFileStr('SYSTEMSET.INI','SERVER','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ','127.0.0.1');
|
|||
|
|
IdFTP1.Username := 'three';
|
|||
|
|
IdFTP1.Password := '641010';
|
|||
|
|
IdFTP1.Connect();
|
|||
|
|
IdFTP1.Put(fFilePath, 'FJ\' + Trim(fFileName));
|
|||
|
|
IdFTP1.Quit;
|
|||
|
|
except
|
|||
|
|
IdFTP1.Quit;
|
|||
|
|
Application.MessageBox('<27>ϴ<EFBFBD><CFB4>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
IdFTP1.Quit;
|
|||
|
|
Panel2.Visible:=false;
|
|||
|
|
Initimage();
|
|||
|
|
end;
|
|||
|
|
adoqueryCmd.Connection.CommitTrans;
|
|||
|
|
except
|
|||
|
|
adoqueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox('<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.Button7Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fFileName:string;
|
|||
|
|
fFilePath:string;
|
|||
|
|
maxNo:string;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
adoqueryCmd.Connection.BeginTrans;
|
|||
|
|
fFilePath:=WJPach.Text;
|
|||
|
|
fFileName:=WJName.Hint;
|
|||
|
|
with adoqueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select TFId from TP_File ');
|
|||
|
|
sql.Add('where WBID='''+trim(FMainid)+'''');
|
|||
|
|
sql.Add(' and TFType=''<27><>˾''');
|
|||
|
|
sql.Add('and FileName='+quotedstr(trim(fFileName)));
|
|||
|
|
open;
|
|||
|
|
IF not adoqueryCmd.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox('<27>˸<EFBFBD><CBB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD><D1B4>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><DEB8>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONERROR);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Panel12.Visible:=False;
|
|||
|
|
Panel2.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>Ե<EFBFBD>...';
|
|||
|
|
Panel2.Visible:=true;
|
|||
|
|
application.ProcessMessages;
|
|||
|
|
|
|||
|
|
if GetLSNo(ADOQueryCmd,maxNo,'FJ','TP_File',4,1)=False then
|
|||
|
|
begin
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with adoqueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete from TP_File ');
|
|||
|
|
sql.Add('where WBID='''+trim(FMainid)+'''');
|
|||
|
|
sql.Add(' and TFType=''<27><>˾''');
|
|||
|
|
sql.Add('and FileName='+quotedstr(trim(fFileName)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
with adoqueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from TP_File ');
|
|||
|
|
sql.Add('where WBID='''+trim(FMainid)+'''');
|
|||
|
|
sql.Add(' and TFType=''<27><>˾''');
|
|||
|
|
sql.Add('and FileName='+quotedstr(trim(fFileName)));
|
|||
|
|
open;
|
|||
|
|
append;
|
|||
|
|
fieldbyname('TFID').Value:=trim(maxNO);
|
|||
|
|
fieldbyname('WBID').Value:=trim(FMainid);
|
|||
|
|
fieldbyname('TFType').Value:='<27><>˾';
|
|||
|
|
fieldbyname('FileName').Value:=trim(fFileName);
|
|||
|
|
post;
|
|||
|
|
end;
|
|||
|
|
if fFilePath <> '' then
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
IdFTP1.Host := ReadINIFileStr('SYSTEMSET.INI','SERVER','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ','127.0.0.1');
|
|||
|
|
IdFTP1.Username := 'three';
|
|||
|
|
IdFTP1.Password := '641010';
|
|||
|
|
IdFTP1.Connect();
|
|||
|
|
IdFTP1.Put(fFilePath, 'FJ\' + Trim(fFileName));
|
|||
|
|
IdFTP1.Quit;
|
|||
|
|
except
|
|||
|
|
IdFTP1.Quit;
|
|||
|
|
Application.MessageBox('<27>ϴ<EFBFBD><CFB4>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
IdFTP1.Quit;
|
|||
|
|
Panel2.Visible:=false;
|
|||
|
|
Initimage();
|
|||
|
|
adoqueryCmd.Connection.CommitTrans;
|
|||
|
|
except
|
|||
|
|
adoqueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox('<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
lstPat := TStringList.Create;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.FormClose(Sender: TObject;
|
|||
|
|
var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
ModalResult:=1;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYX_WorkGSLR.ListView1DblClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
sFieldName:string;
|
|||
|
|
fileName:string;
|
|||
|
|
begin
|
|||
|
|
if ListView1.Items.Count<1 THEN EXIT;
|
|||
|
|
|
|||
|
|
if listView1.SelCount<1 then exit;
|
|||
|
|
sFieldName:=leftbstr(ExtractFilePath(Application.ExeName),1)+':\ͼƬ<CDBC>鿴';
|
|||
|
|
|
|||
|
|
if not DirectoryExists(pchar(sFieldName)) then
|
|||
|
|
CreateDirectory(pchar(sFieldName),nil);
|
|||
|
|
|
|||
|
|
fileName:=ListView1.Selected.Caption;
|
|||
|
|
|
|||
|
|
sFieldName:=sFieldName+'\'+trim(fileName);
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
IdFTP1.Host := ReadINIFileStr('SYSTEMSET.INI','SERVER','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ','127.0.0.1');
|
|||
|
|
IdFTP1.Username := 'three';
|
|||
|
|
IdFTP1.Password := '641010';
|
|||
|
|
IdFTP1.Connect();
|
|||
|
|
except
|
|||
|
|
;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if IdFTP1.Connected then
|
|||
|
|
begin
|
|||
|
|
Panel2.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>Ե<EFBFBD>...';
|
|||
|
|
Panel2.Visible:=true;
|
|||
|
|
application.ProcessMessages;
|
|||
|
|
try
|
|||
|
|
IdFTP1.Get('FJ\'+ Trim(fileName), sFieldName,true, false);
|
|||
|
|
except
|
|||
|
|
Panel2.Visible:=false;
|
|||
|
|
Application.MessageBox('<27>ͻ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
|
|||
|
|
IdFTP1.Quit;
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Panel2.Visible:=false;
|
|||
|
|
Application.MessageBox('<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
|
|||
|
|
IdFTP1.Quit;
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
Panel2.Visible:=false;
|
|||
|
|
if IdFTP1.Connected then IdFTP1.Quit;
|
|||
|
|
ShellExecute(Handle, 'open',PChar(sFieldName),'', '', SW_SHOWNORMAL);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|