347 lines
8.9 KiB
ObjectPascal
347 lines
8.9 KiB
ObjectPascal
|
|
unit U_MLManage_LRTJ;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
|||
|
|
cxDataStorage, cxEdit, DB, cxDBData, ADODB, DBClient, cxGridLevel,
|
|||
|
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
|||
|
|
cxControls, cxGridCustomView, cxGrid, ComCtrls, ToolWin,
|
|||
|
|
cxGridCustomPopupMenu, cxGridPopupMenu, cxContainer, cxTextEdit,
|
|||
|
|
cxMaskEdit, cxDropDownEdit, cxCalendar, StdCtrls, ExtCtrls, BtnEdit,
|
|||
|
|
cxButtonEdit,jpeg,U_SLT,Math, Menus, RM_Common, RM_Class, RM_GridReport,
|
|||
|
|
RM_System, RM_Dataset,U_SLT_PBSK,U_BPZdy_LRSHK, IdBaseComponent,U_SLT_TJ_SX,
|
|||
|
|
IdComponent, IdTCPConnection, IdTCPClient, IdFTP,IniFiles,ShellAPI;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmMLManage_LRTJ = class(TForm)
|
|||
|
|
CDS_Sub: TClientDataSet;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
|
Order_GX: TClientDataSet;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
OrdBP_SH: TClientDataSet;
|
|||
|
|
Ord_HX: TClientDataSet;
|
|||
|
|
adoqueryPicture: TADOQuery;
|
|||
|
|
RMDB_Main: TRMDBDataSet;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
ADOQueryPrint: TADOQuery;
|
|||
|
|
CDS_Print: TClientDataSet;
|
|||
|
|
PopupMenu1: TPopupMenu;
|
|||
|
|
N1: TMenuItem;
|
|||
|
|
SaveDialog1: TSaveDialog;
|
|||
|
|
ODPat: TOpenDialog;
|
|||
|
|
IdFTP1: TIdFTP;
|
|||
|
|
PopupMenu2: TPopupMenu;
|
|||
|
|
MenuItem1: TMenuItem;
|
|||
|
|
Ord_ZB: TClientDataSet;
|
|||
|
|
Panel2: TPanel;
|
|||
|
|
Ord_Col: TClientDataSet;
|
|||
|
|
DataSource2: TDataSource;
|
|||
|
|
ADOQueryCol: TADOQuery;
|
|||
|
|
TJName: TLabel;
|
|||
|
|
TJGYMX: TLabel;
|
|||
|
|
Panel14: TPanel;
|
|||
|
|
Panel4: TPanel;
|
|||
|
|
ScrollBox2: TScrollBox;
|
|||
|
|
ADOQuery1: TADOQuery;
|
|||
|
|
ADOCmd: TADOQuery;
|
|||
|
|
Panel16: TPanel;
|
|||
|
|
ScrollBox3: TPanel;
|
|||
|
|
LBCPAP: TLabel;
|
|||
|
|
BTLP: TButton;
|
|||
|
|
BTNP: TButton;
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure BTLPClick(Sender: TObject);
|
|||
|
|
procedure BTNPClick(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
Fint,my,mz:Integer;
|
|||
|
|
procedure InitSubGrid();
|
|||
|
|
function SaveData():Boolean;
|
|||
|
|
procedure InitColor();
|
|||
|
|
procedure BHCZhu();
|
|||
|
|
procedure ReadINIFile10();
|
|||
|
|
procedure SavePrint(var CP,TP:string);
|
|||
|
|
procedure CreThumb(AJPeg:TJPEGImage;Image1:TImage;Width, Height: Integer);
|
|||
|
|
procedure ShowImage1();
|
|||
|
|
procedure InitColor1();
|
|||
|
|
procedure SaveImage(maxnoWB:string);
|
|||
|
|
procedure initFY();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
lstPat,lstPat2: TStringList;
|
|||
|
|
FCYID,FCYCode,FCPID,FCPNO,FBPID,FGYName,FML,FGYLX,FGSNo,FHXBPID,FGSName,FSKID,FBPIDSH,formid:String;
|
|||
|
|
FGYLXName,PatFile,FTJCoNo,FPTID,FTJTP,FileName,FileName1,FTJHX:string;
|
|||
|
|
FTJML,FTJGYName:String;
|
|||
|
|
procedure initimageSH();
|
|||
|
|
procedure imagePL(FFF:Integer);
|
|||
|
|
procedure ShowImage();
|
|||
|
|
procedure SaveImage1(maxnoWB:string);
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmMLManage_LRTJ: TfrmMLManage_LRTJ;
|
|||
|
|
Mach1: array of TfrmSLT_TJ_SX;
|
|||
|
|
Mach: array of TfrmSLT_PBSK;
|
|||
|
|
implementation
|
|||
|
|
uses
|
|||
|
|
U_DataLink,U_Fun;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.ShowImage1();
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.ShowImage();
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.InitColor1();
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.ReadINIFile10();
|
|||
|
|
var
|
|||
|
|
programIni:Tinifile; //<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
|||
|
|
FileName5:string;
|
|||
|
|
begin
|
|||
|
|
FileName5:=ExtractFilePath(Paramstr(0))+'SYSTEMSET.INI';
|
|||
|
|
programIni:=Tinifile.create(FileName5);
|
|||
|
|
server:=programIni.ReadString('SERVER','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ','127.0.0.1');
|
|||
|
|
programIni.Free;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.InitColor();
|
|||
|
|
begin
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.initFY();
|
|||
|
|
begin
|
|||
|
|
with adoqueryPicture do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select Count(IMID) GS from Image_Info ');
|
|||
|
|
sql.Add('where TJML='''+trim(FTJML)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
my:=1;
|
|||
|
|
mz:=Ceil(adoqueryPicture.fieldbyname('GS').AsInteger/50);
|
|||
|
|
LBCPAP.Caption:=IntToStr(my)+'/'+inttostr(mz);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.initimageSH();
|
|||
|
|
var
|
|||
|
|
i,j,p,x:integer;
|
|||
|
|
jpg:TJpegImage;
|
|||
|
|
myStream: TADOBlobStream;
|
|||
|
|
Fstr:string;
|
|||
|
|
begin
|
|||
|
|
Fstr:=' and TJML='''+trim(FTJML)+''' and TJGYName='''+trim(FTJGYName)+'''';
|
|||
|
|
j:=length(Mach1);
|
|||
|
|
if j>0 then
|
|||
|
|
begin
|
|||
|
|
for i:=0 to j-1 do
|
|||
|
|
begin
|
|||
|
|
Mach1[i].free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
SetLength(Mach1, 0);
|
|||
|
|
try
|
|||
|
|
with adoqueryPicture do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' exec P_View_Image :WBID,:ImageType,:IFType,:Ye,:YeQty,:WPS ');
|
|||
|
|
Parameters.ParamByName('WBID').Value:='CP1910290001';
|
|||
|
|
Parameters.ParamByName('ImageType').Value:='TJ';
|
|||
|
|
Parameters.ParamByName('IFType').Value:='С';
|
|||
|
|
Parameters.ParamByName('Ye').Value:=my;
|
|||
|
|
Parameters.ParamByName('YeQty').Value:=100;
|
|||
|
|
Parameters.ParamByName('WPS').Value:=Trim(Fstr);
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
j:=adoqueryPicture.RecordCount;
|
|||
|
|
if j<1 then exit;
|
|||
|
|
adoqueryPicture.DisableControls;
|
|||
|
|
adoqueryPicture.First;
|
|||
|
|
SetLength(Mach1, j);
|
|||
|
|
with adoqueryPicture do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
i:=0;
|
|||
|
|
x:=0; //<2F><>
|
|||
|
|
p:=0; //<2F><>
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if (i<50*my) and (i>=50*(my-1)) then
|
|||
|
|
begin
|
|||
|
|
jpg:=TJpegImage.Create();
|
|||
|
|
myStream:=tadoblobstream.Create(tblobfield(adoqueryPicture.fieldbyname('ImageFile')),bmread);
|
|||
|
|
jpg.LoadFromStream(myStream);
|
|||
|
|
if (i-50*(my-1))<10*(p+1) then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
p:=p+1;
|
|||
|
|
end;
|
|||
|
|
Mach1[i]:=TfrmSLT_TJ_SX.Create(Self);
|
|||
|
|
Mach1[i].Name:=trim(adoqueryPicture.fieldbyname('IMID').AsString);
|
|||
|
|
Mach1[i].FImagePath:=trim(adoqueryPicture.fieldbyname('ImagePath').AsString);
|
|||
|
|
Mach1[i].Parent:=ScrollBox2;
|
|||
|
|
Mach1[I].Left:=0+(x-10*p)*135;
|
|||
|
|
Mach1[I].Top:=p*190;
|
|||
|
|
Mach1[I].FIMID:=trim(adoqueryPicture.fieldbyname('IMID').AsString);
|
|||
|
|
Mach1[I].FTJHX:=trim(adoqueryPicture.fieldbyname('TJHX').AsString);
|
|||
|
|
Mach1[I].YW.Caption:=trim(adoqueryPicture.fieldbyname('TJHX').AsString);
|
|||
|
|
Mach1[I].TJMLNo.Caption:=trim(adoqueryPicture.fieldbyname('TJMLNo').AsString);
|
|||
|
|
Mach1[I].ZW.Caption:=trim(adoqueryPicture.fieldbyname('TJCol').AsString);
|
|||
|
|
Mach1[I].SH.Caption:=trim(adoqueryPicture.fieldbyname('TJColNo').AsString);
|
|||
|
|
Mach1[I].FIMNO:=trim(adoqueryPicture.fieldbyname('IMNO').AsString);
|
|||
|
|
Mach1[I].FTJTPID:=Trim(adoqueryPicture.fieldbyname('WBID').AsString);
|
|||
|
|
Mach1[i].Formid:='3';
|
|||
|
|
if self.formid='2' then
|
|||
|
|
begin
|
|||
|
|
Mach1[I].Memo1.Visible:=true;
|
|||
|
|
end;
|
|||
|
|
if triM(adoqueryPicture.fieldbyname('IMID').AsString)<>'' then
|
|||
|
|
begin
|
|||
|
|
Mach1[i].Init('',adoqueryPicture.fieldbyname('ImagePath').AsString,jpg);
|
|||
|
|
end;
|
|||
|
|
Mach1[i].cxImage1.Visible:=True;
|
|||
|
|
Mach1[i].cxImage1.Properties.Stretch:=True;
|
|||
|
|
x:=x+1;
|
|||
|
|
end;
|
|||
|
|
i:=i+1;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
adoqueryPicture.EnableControls;
|
|||
|
|
finally
|
|||
|
|
jpg.free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.SavePrint(var CP,TP:string);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.InitSubGrid();
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.SaveImage(maxnoWB:string);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.SaveImage1(maxnoWB:string);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.FormShow(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fsj:String;
|
|||
|
|
begin
|
|||
|
|
initFY();
|
|||
|
|
initimageSH();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmMLManage_LRTJ.SaveData():Boolean;
|
|||
|
|
begin
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.BHCZhu();
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.imagePL(FFF:Integer);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.CreThumb(AJPeg:TJPEGImage;Image1:TImage;Width, Height: Integer);
|
|||
|
|
var
|
|||
|
|
Bitmap: TBitmap;
|
|||
|
|
Ratio: Double;
|
|||
|
|
ARect: TRect;
|
|||
|
|
AHeight, AHeightOffset: Integer;
|
|||
|
|
AWidth, AWidthOffset: Integer;
|
|||
|
|
begin
|
|||
|
|
Bitmap := TBitmap.Create;
|
|||
|
|
try
|
|||
|
|
Ratio := AJPeg.Width /AJPeg.Height;
|
|||
|
|
if Ratio > 1.333 then
|
|||
|
|
begin
|
|||
|
|
AHeight := Round(Width / Ratio);
|
|||
|
|
AHeightOffset := (Height - AHeight) div 2;
|
|||
|
|
AWidth := Width;
|
|||
|
|
AWidthOffset := 0;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
AWidth := Round(Height * Ratio);
|
|||
|
|
AWidthOffset := (Width - AWidth) div 2;
|
|||
|
|
AHeight := Height;
|
|||
|
|
AHeightOffset := 0;
|
|||
|
|
end;
|
|||
|
|
Bitmap.Width := Width;
|
|||
|
|
Bitmap.Height := Height;
|
|||
|
|
Bitmap.Canvas.Brush.Color := clBtnFace;
|
|||
|
|
Bitmap.Canvas.FillRect(Rect(0, 0, Width, Height));
|
|||
|
|
ARect := Rect(AWidthOffset, AHeightOffset, AWidth + AWidthOffset, AHeight + AHeightOffset);
|
|||
|
|
Bitmap.Canvas.StretchDraw(ARect, AJPeg);
|
|||
|
|
Image1.Picture.Assign(BitMap);
|
|||
|
|
finally
|
|||
|
|
Bitmap.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.FormClose(Sender: TObject;
|
|||
|
|
var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Finalize(Mach1);
|
|||
|
|
Finalize(Mach);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
lstPat := TStringList.Create;
|
|||
|
|
lstPat2 := TStringList.Create;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.BTLPClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if my<=1 then exit;
|
|||
|
|
my:=my-1;
|
|||
|
|
LBCPAP.Caption:=IntToStr(my)+'/'+inttostr(mz);
|
|||
|
|
initimageSH();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmMLManage_LRTJ.BTNPClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if my>=mz then exit;
|
|||
|
|
my:=my+1;
|
|||
|
|
LBCPAP.Caption:=IntToStr(my)+'/'+inttostr(mz);
|
|||
|
|
initimageSH();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
end.
|