From d40c72dd652f5b0eb808ac9b460c389bf197581d Mon Sep 17 00:00:00 2001 From: "DESKTOP-E401PHE\\Administrator" Date: Wed, 14 May 2025 14:00:08 +0800 Subject: [PATCH] ~ --- .../U_ZdyAttInputCP.dfm | 13 + .../U_ZdyAttInputCP.pas | 29 +- 基础资料维护(BaseInfo.dll)/U_ZdyAttachCP.dfm | 6 + 基础资料维护(BaseInfo.dll)/U_ZdyAttachCP.pas | 5 +- 基础资料维护(BaseInfo.dll)/getpic.dfm | 157 +++++ 基础资料维护(BaseInfo.dll)/getpic.pas | 595 ++++++++++++++++++ 管理系统/U_ClothContractInPut_CG.dfm | 1 + 管理系统/U_ClothContractInPut_Dp.pas | 3 + 管理系统/U_ClothContractInPut_Tp.dfm | 7 + 管理系统/U_ClothContractInPut_Tp.pas | 6 + 管理系统/U_ClothContractList_CK.dfm | 28 +- 管理系统/U_ClothContractList_CK.pas | 92 ++- 管理系统/U_ClothContractList_DY.pas | 2 +- 管理系统/U_ClothContractList_JG.dfm | 6 + 管理系统/U_ClothContractList_JG.pas | 5 +- 15 files changed, 880 insertions(+), 75 deletions(-) create mode 100644 基础资料维护(BaseInfo.dll)/getpic.dfm create mode 100644 基础资料维护(BaseInfo.dll)/getpic.pas diff --git a/基础资料维护(BaseInfo.dll)/U_ZdyAttInputCP.dfm b/基础资料维护(BaseInfo.dll)/U_ZdyAttInputCP.dfm index dc81970..70af049 100644 --- a/基础资料维护(BaseInfo.dll)/U_ZdyAttInputCP.dfm +++ b/基础资料维护(BaseInfo.dll)/U_ZdyAttInputCP.dfm @@ -208,6 +208,19 @@ object frmZdyAttInputCP: TfrmZdyAttInputCP HeaderAlignmentHorz = taCenter Width = 60 end + object Tv2Column6: TcxGridDBColumn + Caption = #22270#29255 + DataBinding.FieldName = 'CPFile' + PropertiesClassName = 'TcxButtonEditProperties' + Properties.Buttons = < + item + Default = True + Kind = bkEllipsis + end> + Properties.OnButtonClick = Tv2Column6PropertiesButtonClick + HeaderAlignmentHorz = taCenter + Width = 60 + end end object cxGridLevel1: TcxGridLevel GridView = Tv2 diff --git a/基础资料维护(BaseInfo.dll)/U_ZdyAttInputCP.pas b/基础资料维护(BaseInfo.dll)/U_ZdyAttInputCP.pas index 2523b1b..1d98153 100644 --- a/基础资料维护(BaseInfo.dll)/U_ZdyAttInputCP.pas +++ b/基础资料维护(BaseInfo.dll)/U_ZdyAttInputCP.pas @@ -29,7 +29,7 @@ uses dxSkinscxPCPainter; type - TfrmZdyAttInputCP = class(TForm) + TfrmZdyAttInputCP = class(TForm) ToolBar1: TToolBar; TBClose: TToolButton; ADOQueryTemp: TADOQuery; @@ -73,6 +73,7 @@ type Tv2Column3: TcxGridDBColumn; Tv2Column4: TcxGridDBColumn; Tv2Column5: TcxGridDBColumn; + Tv2Column6: TcxGridDBColumn; procedure FormDestroy(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure TBCloseClick(Sender: TObject); @@ -86,6 +87,7 @@ type procedure ToolButton2Click(Sender: TObject); procedure Tv1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure Tv1Column2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); + procedure Tv2Column6PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); private { Private declarations } procedure InitGrid(); @@ -95,6 +97,7 @@ type { Public declarations } RKFlag, FCYID, Fzdyname: string; fkhType: string; + fFlileFlag: string; end; var @@ -103,7 +106,7 @@ var implementation uses - U_DataLink, U_Fun, U_ZDYHelp, U_ZdyAttachGYSxz; + U_DataLink, U_Fun, U_ZDYHelp, U_ZdyAttachGYSxz, getpic; {$R *.dfm} @@ -224,7 +227,7 @@ begin end else begin - Edit; + Edit; FieldByName('Editer').Value := Trim(DName); FieldByName('Edittime').Value := SGetServerDateTime(ADOQueryTemp); end; @@ -238,6 +241,7 @@ begin FieldByName('Type').Value := 'CP'; FieldByName('khType').Value := trim(fkhType); FieldByName('Filler').Value := Trim(DName); + FieldByName('CPFile').Value := Trim(CDS_HZ.fieldbyname('CPFile').AsString); Post; end; with ADOQueryCmd do @@ -567,5 +571,24 @@ begin end; end; +procedure TfrmZdyAttInputCP.Tv2Column6PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); +begin + FormGetPic := TFormGetPic.create(self); + with FormGetPic do + begin + fFlileFlag := self.fFlileFlag; + fkeyNo := CDS_HZ.fieldbyname('CPFile').asstring; + pat1 := 'FileName'; + pic1 := 'FilesOther'; + FTFType := 'CP'; + if showmodal = 1 then + begin + CDS_HZ.edit; + CDS_HZ.fieldbyname('CPFile').Value := trim(fkeyNo); + end; + free; + end; +end; + end. diff --git a/基础资料维护(BaseInfo.dll)/U_ZdyAttachCP.dfm b/基础资料维护(BaseInfo.dll)/U_ZdyAttachCP.dfm index 8dc2ca1..55bb819 100644 --- a/基础资料维护(BaseInfo.dll)/U_ZdyAttachCP.dfm +++ b/基础资料维护(BaseInfo.dll)/U_ZdyAttachCP.dfm @@ -364,6 +364,12 @@ object frmZdyAttachCP: TfrmZdyAttachCP HeaderAlignmentHorz = taCenter Width = 60 end + object Tv2Column6: TcxGridDBColumn + Caption = #22270#29255 + DataBinding.FieldName = 'CPFile' + HeaderAlignmentHorz = taCenter + Width = 60 + end end object cxGridLevel1: TcxGridLevel GridView = Tv2 diff --git a/基础资料维护(BaseInfo.dll)/U_ZdyAttachCP.pas b/基础资料维护(BaseInfo.dll)/U_ZdyAttachCP.pas index 90e44dd..56c9831 100644 --- a/基础资料维护(BaseInfo.dll)/U_ZdyAttachCP.pas +++ b/基础资料维护(BaseInfo.dll)/U_ZdyAttachCP.pas @@ -97,6 +97,7 @@ type Tv2Column3: TcxGridDBColumn; Tv2Column4: TcxGridDBColumn; Tv2Column5: TcxGridDBColumn; + Tv2Column6: TcxGridDBColumn; procedure FormDestroy(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure TBCloseClick(Sender: TObject); @@ -134,14 +135,14 @@ uses procedure TfrmZdyAttachCP.InitGrid(); begin try - ADOQueryMain.DisableControls; + ADOQueryMain.DisableControls; with ADOQueryMain do begin Filtered := False; Close; SQL.Clear; sql.Add(' select ATID,ZdyName,ZdyCode,DEFstr1,DEFstr2,defNote1,Mrate,defNote2,defNote3,DEFstr3,DEFstr5,DEFstr4,DEFstr10,'); - sql.Add(' DEFstr6,DEFstr7,DEFstr8,Note,DEFstr4,DEFstr5,defflt1,Filler,FillTime '); + sql.Add(' DEFstr6,DEFstr7,DEFstr8,Note,DEFstr4,DEFstr5,defflt1,Filler,FillTime,CPFile '); sql.Add(' from KH_Zdy_Attachment where Type=''CP'' and isnull(DEFstr5,'''')<>'''' '); // sql.Add(' and isnull(khType,'''')=' + quotedstr(trim(fkhType))); sql.Add(' order by zdyName,dbo.getNum_copy1(Defstr3) '); diff --git a/基础资料维护(BaseInfo.dll)/getpic.dfm b/基础资料维护(BaseInfo.dll)/getpic.dfm new file mode 100644 index 0000000..981c796 --- /dev/null +++ b/基础资料维护(BaseInfo.dll)/getpic.dfm @@ -0,0 +1,157 @@ +object FormGetPic: TFormGetPic + Left = 244 + Top = 118 + BorderIcons = [biSystemMenu] + BorderStyle = bsSingle + Caption = #33719#21462#22270#29255 + ClientHeight = 449 + ClientWidth = 670 + Color = clBtnFace + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = #23435#20307 + Font.Style = [] + OldCreateOrder = False + Position = poDesktopCenter + OnCreate = FormCreate + OnDestroy = FormDestroy + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 12 + object Image2: TImage + Left = 464 + Top = 8 + Width = 160 + Height = 120 + end + object SpeedButton1: TSpeedButton + Left = 500 + Top = 334 + Width = 80 + Height = 22 + Caption = #25171#24320#22270#29255'...' + OnClick = SpeedButton1Click + end + object SpeedButton2: TSpeedButton + Left = 500 + Top = 380 + Width = 80 + Height = 22 + Caption = #30830#23450 + Enabled = False + OnClick = SpeedButton2Click + end + object SpeedButton3: TSpeedButton + Left = 500 + Top = 426 + Width = 80 + Height = 22 + Caption = #25918#24323 + OnClick = SpeedButton3Click + end + object SpeedButton4: TSpeedButton + Left = 500 + Top = 358 + Width = 80 + Height = 22 + Caption = #22270#29255#21478#23384'...' + OnClick = SpeedButton4Click + end + object SpeedButton5: TSpeedButton + Left = 500 + Top = 404 + Width = 80 + Height = 22 + Caption = #21024#38500 + OnClick = SpeedButton5Click + end + object ScrollBox1: TScrollBox + Left = 5 + Top = 5 + Width = 440 + Height = 440 + HorzScrollBar.Visible = False + VertScrollBar.Visible = False + TabOrder = 0 + object Image1: TImage + Left = 0 + Top = 0 + Width = 437 + Height = 436 + Cursor = crSizeAll + AutoSize = True + Center = True + IncrementalDisplay = True + OnMouseDown = Image1MouseDown + OnMouseMove = Image1MouseMove + end + end + object Button1: TButton + Left = 464 + Top = 252 + Width = 81 + Height = 21 + Caption = #25171#24320#25668#20687#22836 + TabOrder = 1 + OnClick = Button1Click + end + object Button2: TButton + Left = 560 + Top = 252 + Width = 81 + Height = 21 + Caption = #25235#22270 + TabOrder = 2 + OnClick = Button2Click + end + object Twain: TDelphiTwain + OnTwainAcquire = TwainTwainAcquire + TransferMode = ttmMemory + SourceCount = 0 + Info.MajorVersion = 1 + Info.MinorVersion = 0 + Info.Language = tlUserLocale + Info.CountryCode = 1 + Info.Groups = [tgControl, tgImage] + Info.VersionInfo = 'Application name' + Info.Manufacturer = 'Application manufacturer' + Info.ProductFamily = 'App product family' + Info.ProductName = 'App product name' + LibraryLoaded = False + SourceManagerLoaded = False + Left = 518 + Top = 160 + end + object OpenPictureDialog1: TOpenPictureDialog + DefaultExt = 'jpg' + Filter = 'JPEG '#22270#24418#25991#20214' (*.jpg)|*.jpg' + Left = 568 + Top = 152 + end + object ADOQuery1: TADOQuery + Connection = DataLink_BaseInfo.ADOLink + Parameters = <> + Left = 504 + Top = 280 + end + object SaveDialog1: TSavePictureDialog + Filter = 'JPG'#22270#29255#26684#24335' (*.JPG)|*.JPG' + Left = 568 + Top = 299 + end + object adoqueryImage: TADOQuery + Connection = DataLink_BaseInfo.ADOLink + Parameters = <> + Left = 488 + Top = 184 + end + object IdFTP1: TIdFTP + MaxLineAction = maException + ReadTimeout = 0 + ProxySettings.ProxyType = fpcmNone + ProxySettings.Port = 0 + Left = 500 + Top = 198 + end +end diff --git a/基础资料维护(BaseInfo.dll)/getpic.pas b/基础资料维护(BaseInfo.dll)/getpic.pas new file mode 100644 index 0000000..69c661e --- /dev/null +++ b/基础资料维护(BaseInfo.dll)/getpic.pas @@ -0,0 +1,595 @@ +unit getpic; + +interface + +uses + Windows, Messages, SysUtils, strUtils,Variants, Classes, Graphics, Controls, Forms, + Dialogs, ComCtrls, ToolWin, ExtCtrls, jpeg, IniFiles, ExtDlgs, + DelphiTwain, Buttons, StdCtrls, DB, ADODB, IdBaseComponent, IdComponent, + IdTCPConnection, IdTCPClient, IdFTP; + +type + TFormGetPic = class(TForm) + Twain: TDelphiTwain; + ScrollBox1: TScrollBox; + Image1: TImage; + OpenPictureDialog1: TOpenPictureDialog; + Image2: TImage; + SpeedButton1: TSpeedButton; + SpeedButton2: TSpeedButton; + SpeedButton3: TSpeedButton; + Button1: TButton; + Button2: TButton; + ADOQuery1: TADOQuery; + SpeedButton4: TSpeedButton; + SaveDialog1: TSavePictureDialog; + adoqueryImage: TADOQuery; + IdFTP1: TIdFTP; + SpeedButton5: TSpeedButton; + procedure ToolButton1Click(Sender: TObject); + procedure ToolButton3Click(Sender: TObject); + procedure TwainTwainAcquire(Sender: TObject; const Index: Integer; + Image: TBitmap; var Cancel: Boolean); + procedure FormShow(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure Image1MouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X, + Y: Integer); + procedure SpeedButton1Click(Sender: TObject); + procedure SpeedButton2Click(Sender: TObject); + procedure SpeedButton3Click(Sender: TObject); + procedure Button1Click(Sender: TObject); + procedure Button2Click(Sender: TObject); + procedure SpeedButton4Click(Sender: TObject); + procedure Initimage(); + procedure SpeedButton5Click(Sender: TObject); + private + hWndC : THandle; + CapturingAVI : bool; + { Private declarations } + ClickPos: TPoint; + SelectedSource, PicLeft, PicTop, PicWidth, PicHeight: Integer; + procedure CreThumb(Width, Height: Integer); + function SaveImage():Boolean; + public + FilePath:string; + FileName:string; + FTFType:string; + pat1:string; + pic1:string; + fkeyNo:string; + fFlileFlag:string; + { Public declarations } + MyJpeg: TJPEGImage; +// JPStream: TMemoryStream; + end; + +var + FormGetPic: TFormGetPic; + +implementation +uses U_DataLink,U_Fun10; +const WM_CAP_START = WM_USER; +const WM_CAP_STOP = WM_CAP_START + 68; +const WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10; +const WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11; +const WM_CAP_SAVEDIB = WM_CAP_START + 25; +const WM_CAP_GRAB_FRAME = WM_CAP_START + 60; +const WM_CAP_SEQUENCE = WM_CAP_START + 62; +const WM_CAP_FILE_SET_CAPTURE_FILEA = WM_CAP_START + 20; +const WM_CAP_SEQUENCE_NOFILE =WM_CAP_START+ 63 ; +const WM_CAP_SET_OVERLAY =WM_CAP_START+ 51 ; +const WM_CAP_SET_PREVIEW =WM_CAP_START+ 50 ; +const WM_CAP_SET_CALLBACK_VIDEOSTREAM = WM_CAP_START +6; +const WM_CAP_SET_CALLBACK_ERROR=WM_CAP_START +2; +const WM_CAP_SET_CALLBACK_STATUSA= WM_CAP_START +3; +const WM_CAP_SET_CALLBACK_FRAME= WM_CAP_START +5; +const WM_CAP_SET_SCALE=WM_CAP_START+ 53 ; +const WM_CAP_SET_PREVIEWRATE=WM_CAP_START+ 52 ; +function capCreateCaptureWindowA(lpszWindowName : PCHAR; +dwStyle : longint; +x : integer; +y : integer; +nWidth : integer; +nHeight : integer; +ParentWin : HWND; +nId : integer): HWND; +STDCALL EXTERNAL 'AVICAP32.DLL'; + +{$R *.dfm} + +procedure TFormGetPic.Initimage(); +var + jpg:TJpegImage; + myStream: TADOBlobStream; + sFieldName:string; + JPStream: TMemoryStream; +begin + jpg:=TJpegImage.Create(); + JPStream := TMemoryStream.Create; + try + + with adoqueryImage do + begin + close; + sql.Clear; + sql.Add('select * from TP_File where WBID='+quotedstr(trim(fkeyNo))); + open; + IF not IsEmpty then + begin + IF not fieldbyname(pic1).IsNull then + begin + myStream:=tadoblobstream.Create(tblobfield(adoqueryImage.fieldbyname(pic1)),bmread); + jpg.LoadFromStream(myStream); + Image2.Picture.Assign(jpg); + myStream.Free; + + try + IdFTP1.Host := ReadINIFileStr('SYSTEMSET.INI','SERVER','ַ','127.0.0.1'); + IdFTP1.Username := 'three'; + IdFTP1.Password := '641010'; + IdFTP1.Connect(); + except + ; + end; + + JPStream.Clear; + if IdFTP1.Connected then + begin + try + IdFTP1.Get(fFlileFlag+'\'+ Trim(fieldbyname(pat1).AsString), JPStream); + except + Application.MessageBox('ͻͼļ', 'ʾ', MB_ICONWARNING); + IdFTP1.Quit; + Exit; + end; + end + else + begin + Application.MessageBox('޷ļ', 'ʾ', MB_ICONWARNING); + IdFTP1.Quit; + Exit; + end; + + if IdFTP1.Connected then IdFTP1.Quit; + JPStream.Position := 0; + jpg.LoadFromStream(JPStream); + Image1.Picture.Assign(jpg); + end; + end; + end; + finally + jpg.free; + JPStream.Free; + end; +end; + +function TFormGetPic.SaveImage():Boolean; +var + myStream: TADOBlobStream; + maxNo:string; + fNewFileName:string; +begin + fNewFileName:=formatdatetime('yyyyMMddhhnnsszzz',now())+ExtractFileExt(FilePath); + IF fkeyNO='' then fkeyNO:=fNewFileName; + result:=false; + try + with adoqueryImage do + begin + close; + sql.Clear; + sql.Add('select * from TP_File where WBID='+quotedstr(trim(fkeyNo))); + sql.Add('and TFType='+quotedstr(trim(FTFType))); + open; + if RecordCount<=0 then + begin + Append; + if GetLSNo(ADOQuery1,maxNo,'FJ','TP_File',4,1)=False then + begin + Application.MessageBox('ȡʧܣ','ʾ',0); + Exit; + end; + fieldByName('TFID').AsString := maxNo; + fieldByName('WBID').AsString := fkeyNO; + end + else + begin + edit; + end; + fieldByName(pat1).AsString :=trim(fNewFileName); + fieldByName('Filler').AsString :=trim(dName); + fieldByName('TFType').AsString :=trim(FTFType); + myStream := TADOBlobStream.Create(TBlobField(FieldByName(pic1)), bmWrite); + MyJpeg.Assign(Image2.Picture.Graphic); + MyJpeg.SaveToStream(myStream); + myStream.Free; + Post; + end; + + if FilePath <> '' then + begin + try + IdFTP1.Host := ReadINIFileStr('SYSTEMSET.INI','SERVER','ַ','127.0.0.1'); + IdFTP1.Username := 'three'; + IdFTP1.Password := '641010'; + IdFTP1.Connect(); + IdFTP1.Put(FilePath, fFlileFlag+'\' + Trim(fNewFileName)); + IdFTP1.Quit; + except + IdFTP1.Quit; + Application.MessageBox('ϴͻͼļʧܣļ', 'ʾ', MB_ICONWARNING); + end; + end; + IdFTP1.Quit; + + result:=true; + except + myStream.Free; + end; +end; + +procedure TFormGetPic.ToolButton1Click(Sender: TObject); +var + Ini: TIniFile; +begin + if Twain.LoadLibrary then + begin + {Load source manager} + Twain.SourceManagerLoaded := TRUE; + {Allow user to select source} + SelectedSource := Twain.SelectSource; + if SelectedSource <> -1 then + begin + Ini := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'scanner.ini'); + try + Ini.WriteInteger( 'SCANNER', 'Scanner', SelectedSource); + finally + Ini.Free; + end; + end {if SelectedSource <> -1} + end + else + ShowMessage('δװɨ'); +end; + +procedure TFormGetPic.ToolButton3Click(Sender: TObject); +begin + if Twain.LoadLibrary then + begin + {Load source manager} + Twain.SourceManagerLoaded := TRUE; + + if SelectedSource <> -1 then + begin + {Load source, select transference method and enable (display interface)} + Twain.Source[SelectedSource].Loaded := TRUE; + Twain.Source[SelectedSource].SetICapUnits(tuInches); + Twain.Source[SelectedSource].SetImagelayoutFrame(PicLeft/25.4, PicTop/25.4, (PicLeft+PicWidth)/25.4, (PicTop+PicHeight)/25.4); + Twain.Source[SelectedSource].SetIYResolution(200); + Twain.Source[SelectedSource].SetIXResolution(200); + Twain.Source[SelectedSource].TransferMode := ttmMemory; + Twain.Source[SelectedSource].EnableSource(FALSE, TRUE); + while Twain.Source[SelectedSource].Enabled do Application.ProcessMessages; + end; {if SelectedSource <> -1} +// Twain.UnloadLibrary; + end + else + ShowMessage('δװɨ'); +end; + +procedure TFormGetPic.TwainTwainAcquire(Sender: TObject; + const Index: Integer; Image: TBitmap; var Cancel: Boolean); +begin + Image1.Picture.Assign(Image); + Cancel := TRUE; + CreThumb(150, 150); + SpeedButton2.Enabled := TRUE; +end; + +procedure TFormGetPic.FormShow(Sender: TObject); +var + Ini: TIniFile; +begin + { Ini := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'scanner.ini'); + try + SelectedSource := Ini.ReadInteger( 'SCANNER', 'Scanner', 0); + PicLeft := Ini.ReadInteger( 'SCANNER', 'Left', 0); + PicTop := Ini.ReadInteger( 'SCANNER', 'Top', 0); + PicWidth := Ini.ReadInteger( 'SCANNER', 'Width', 100); + PicHeight := Ini.ReadInteger( 'SCANNER', 'Height', 100); + finally + Ini.Free; + end; } + Initimage(); +end; + +{ +procedure TFormGetPic.ToolButton6Click(Sender: TObject); +var + Ini: TIniFile; +begin + FormGetPos := TFormGetPos.Create(Self); + FormGetPos.SpinEdit1.Value := PicLeft; + FormGetPos.SpinEdit2.Value := PicTop; + FormGetPos.SpinEdit3.Value := PicWidth; + FormGetPos.SpinEdit4.Value := PicHeight; + if FormGetPos.ShowModal = 1 then + begin + PicLeft := FormGetPos.SpinEdit1.Value; + PicTop := FormGetPos.SpinEdit2.Value; + PicWidth := FormGetPos.SpinEdit3.Value; + PicHeight := FormGetPos.SpinEdit4.Value; + + Ini := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'scanner.ini'); + try + Ini.WriteInteger( 'SCANNER', 'Left', PicLeft); + Ini.WriteInteger( 'SCANNER', 'Top', PicTop); + Ini.WriteInteger( 'SCANNER', 'Width', PicWidth); + Ini.WriteInteger( 'SCANNER', 'Height', PicHeight); + finally + Ini.Free; + end; + end; + FormGetPos.Free; +end; +} + +procedure TFormGetPic.CreThumb(Width, Height: Integer); +var + Bitmap: TBitmap; + Ratio: Double; + ARect: TRect; + AHeight, AHeightOffset: Integer; + AWidth, AWidthOffset: Integer; +begin + Bitmap := TBitmap.Create; + try + Ratio := Image1.Picture.Graphic.Width/Image1.Picture.Graphic.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)); +// StretchDraw original image + ARect := Rect(AWidthOffset, AHeightOffset, AWidth+AWidthOffset, AHeight+AHeightOffset); + Bitmap.Canvas.StretchDraw(ARect, Image1.Picture.Graphic); +// Assign back to the Jpeg, and save to the file + Image2.Picture.Assign(BitMap); +// MyJpeg1.Assign(Image2.Picture.Graphic); + finally + Bitmap.Free; + end; +end; + +procedure TFormGetPic.FormCreate(Sender: TObject); +begin + MyJpeg := TJpegImage.Create; +// MyJpeg1 := TJpegImage.Create; + Button2.Enabled:=false; +end; + +procedure TFormGetPic.FormDestroy(Sender: TObject); +begin +// MyJpeg1.Free; + MyJpeg.Free; +end; + +procedure TFormGetPic.Image1MouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + ClickPos.x := X; + ClickPos.y := Y; +end; + +procedure TFormGetPic.Image1MouseMove(Sender: TObject; Shift: TShiftState; + X, Y: Integer); +var + NewPos: TPoint; +begin + {The left button was pressed} + if ssLeft in Shift then + begin + {Calculate new position} + NewPos.X := Image1.Left + x - ClickPos.x; + NewPos.Y := Image1.Top + y - ClickPos.y; + if NewPos.x + Image1.Width < ScrollBox1.Width then + NewPos.x := ScrollBox1.Width - Image1.Width; + if NewPos.y + Image1.Height < ScrollBox1.Height then + NewPos.y := ScrollBox1.Height - Image1.Height; + if NewPos.X > 0 then NewPos.X := 0; + if NewPos.Y > 0 then NewPos.Y := 0; + + Image1.Top := NewPos.Y; + Image1.Left := NewPos.X; + end {if ssLeft in Shift} +end; + +procedure TFormGetPic.SpeedButton1Click(Sender: TObject); +begin + if OpenPictureDialog1.Execute then + begin + Image1.Top := 0; + Image1.Left := 0; + Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName); + FilePath:=OpenPictureDialog1.FileName; + FileName:=ExtractFileName(FilePath); + CreThumb(240, 180); + SpeedButton2.Enabled := TRUE; + end; +end; + +procedure TFormGetPic.SpeedButton2Click(Sender: TObject); +begin + + IF SaveImage() then + begin + ModalResult := 1; + end + else + begin + application.MessageBox('ݱʧܣ','ʾϢ',0) + end; +// JPStream := TMemoryStream.Create; +// MyJPeg.Assign(Image1.Picture.Graphic); +// MyJPeg.SaveToStream(JPStream); + +end; + +procedure TFormGetPic.SpeedButton3Click(Sender: TObject); +begin + ModalResult := 2; +end; + +procedure TFormGetPic.Button1Click(Sender: TObject); +begin + hWndC := 0; + try + hWndC := capCreateCaptureWindowA('My Own Capture Window', + WS_CHILD or WS_VISIBLE , + ScrollBox1.Left, + ScrollBox1.Top, + ScrollBox1.Width, + ScrollBox1.Height, + FormGetPic.Handle, + 0); + if hWndC <> 0 then + begin + SendMessage(hWndC, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, 0); + SendMessage(hWndC, WM_CAP_SET_CALLBACK_ERROR, 0, 0); + SendMessage(hWndC, WM_CAP_SET_CALLBACK_STATUSA, 0, 0); + SendMessage(hWndC, WM_CAP_DRIVER_CONNECT, 0, 0); + SendMessage(hWndC, WM_CAP_SET_SCALE, 1, 0); + SendMessage(hWndC, WM_CAP_SET_PREVIEWRATE, 66, 0); + //SendMessage(hWndC, WM_CAP_SEQUENCE_NOFILE, 1, 0); + SendMessage(hWndC, WM_CAP_SET_OVERLAY, 1, 0); + SendMessage(hWndC, WM_CAP_SET_PREVIEW, 1, 0); + Button1.Enabled:=false; + Button2.Enabled:=true; + end + else + begin + application.MessageBox('ͷʧܣ','Ϣ',MB_ICONERROR); + end; + except + end; + application.ProcessMessages; +end; + +procedure TFormGetPic.Button2Click(Sender: TObject); +var + sFieldName:string; + MBMP:TBitmap; + MJPG:TJpegImage; +begin + + sFieldName:='D:\ץͼ'; + if not DirectoryExists(pchar(sFieldName)) then + CreateDirectory(pchar(sFieldName),nil); + + sFieldName:=sFieldName+'\'+formatdateTime('yyyyMMddhhnnss',SGetServerDateTime(ADOQuery1)); + + FileName:=ExtractFileName(sFieldName); + if hWndC <> 0 then + begin + SendMessage(hWndC,WM_CAP_SAVEDIB,0,longint(pchar(sFieldName+'.BMP'))); + SendMessage(hWndC, WM_CAP_DRIVER_DISCONNECT, 0, 0); + hWndC := 0; + application.ProcessMessages; + Button1.Enabled:=true; + Button2.Enabled:=false; + try + MBMP:= TBitmap.Create; + MJPG:= TJpegImage.Create; + MBMP.LoadFromFile(pchar(sFieldName+'.BMP')); + MJPG.assign(MBMP); + Image1.Picture.Bitmap.Assign(MJPG); + application.ProcessMessages; + MJPG.SaveToFile(pchar(sFieldName+'.JPG')); + CreThumb(240, 180); + finally + MBMP.Free; + MJPG.Free; + if Fileexists(pchar(sFieldName+'.BMP')) then DeleteFile(pchar(sFieldName+'.BMP')); + FilePath:=sFieldName+'.JPG'; + FileName:=ExtractFileName(FilePath); + end; + SpeedButton2.Enabled:=true; + end; +end; + +procedure TFormGetPic.SpeedButton4Click(Sender: TObject); +var + MJPG:TJpegImage; + pathFile:string; +begin + if Image1.Picture.Graphic=nil then exit; + + MJPG:= TJpegImage.Create; + try + SaveDialog1.FileName:=FileName; + if SaveDialog1.Execute then + begin + if SaveDialog1.FileName<>'' then + begin + pathFile:=trim(SaveDialog1.FileName); + + IF (RightStr(UPPERCASE(pathFile),4)<>'.JPG') and (RightStr(UPPERCASE(pathFile),5)<>'.JPEG') then + begin + pathFile:=pathFile+'.JPG'; + end; + MJPG.Assign(Image1.Picture.Graphic); + if fileexists(pathFile) then + begin + if application.MessageBox(pchar('ļ['+trim(pathFile)+']ѴڣǷҪ滻'),'ʾϢ',MB_YESNO+mb_iconinformation+MB_DEFBUTTON2)=idyes then + MJPG.SaveToFile(pathFile); + end + else + MJPG.SaveToFile(pathFile); + + end; + end; + finally + MJPG.Free; + end; +end; + +procedure TFormGetPic.SpeedButton5Click(Sender: TObject); +begin + + try + with adoqueryImage do + begin + close; + sql.Clear; + sql.Add('select * from TP_File where WBID='+quotedstr(trim(fkeyNo))); + open; + if RecordCount>0 then + begin + edit; + fieldByName(pat1).Value:=null; + FieldByName(pic1).Value:=null; + post; + Image1.Picture.Assign(nil); + Image2.Picture.Assign(nil); + end; + end; + except + end; +end; + +end. diff --git a/管理系统/U_ClothContractInPut_CG.dfm b/管理系统/U_ClothContractInPut_CG.dfm index fbcf39b..0f3b8b4 100644 --- a/管理系统/U_ClothContractInPut_CG.dfm +++ b/管理系统/U_ClothContractInPut_CG.dfm @@ -331,6 +331,7 @@ object frmClothContractInPut_CG: TfrmClothContractInPut_CG Default = True Kind = bkEllipsis end> + Properties.ReadOnly = True Properties.OnButtonClick = JHPlacePropertiesButtonClick Style.BorderStyle = ebsSingle TabOrder = 9 diff --git a/管理系统/U_ClothContractInPut_Dp.pas b/管理系统/U_ClothContractInPut_Dp.pas index 6528ae4..7d10ad0 100644 --- a/管理系统/U_ClothContractInPut_Dp.pas +++ b/管理系统/U_ClothContractInPut_Dp.pas @@ -851,6 +851,9 @@ begin Self.Order_Sub.FieldByName('C_Code').Value := Trim(CDS_HZ.fieldbyname('ZdyCode').AsString); Self.Order_Sub.FieldByName('C_CodeName').Value := Trim(CDS_HZ.fieldbyname('ZDYName').AsString); Self.Order_Sub.FieldByName('C_Color').Value := Trim(CDS_HZ.fieldbyname('DEFstr3').AsString); + Self.Order_Sub.FieldByName('C_Spec').Value := Trim(CDS_HZ.fieldbyname('DEFstr4').AsString); + Self.Order_Sub.FieldByName('KZQty').Value := Trim(CDS_HZ.fieldbyname('DEFstr2').AsString); + Self.Order_Sub.FieldByName('MFQty').Value := Trim(CDS_HZ.fieldbyname('DEFstr1').AsString); // Self.Order_Sub.FieldByName('SOrddefstr4').Value:=Trim(ClientDataSet1.fieldbyname('Note').AsString); Self.Order_Sub.Post; diff --git a/管理系统/U_ClothContractInPut_Tp.dfm b/管理系统/U_ClothContractInPut_Tp.dfm index 3cca6fb..8475d37 100644 --- a/管理系统/U_ClothContractInPut_Tp.dfm +++ b/管理系统/U_ClothContractInPut_Tp.dfm @@ -639,6 +639,13 @@ object frmClothContractInPut_Tp: TfrmClothContractInPut_Tp HeaderAlignmentHorz = taCenter Width = 80 end + object Tv1Column4: TcxGridDBColumn + Caption = #24037#33402 + DataBinding.FieldName = 'gongyi' + Visible = False + HeaderAlignmentHorz = taCenter + Width = 60 + end end object cxGrid1Level1: TcxGridLevel GridView = Tv1 diff --git a/管理系统/U_ClothContractInPut_Tp.pas b/管理系统/U_ClothContractInPut_Tp.pas index 009e2a2..39c2876 100644 --- a/管理系统/U_ClothContractInPut_Tp.pas +++ b/管理系统/U_ClothContractInPut_Tp.pas @@ -97,6 +97,7 @@ type Tv1Column3: TcxGridDBColumn; Label13: TLabel; DYer: TBtnEditC; + Tv1Column4: TcxGridDBColumn; procedure TBCloseClick(Sender: TObject); procedure TVZDYCellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean); procedure Button1Click(Sender: TObject); @@ -495,6 +496,11 @@ begin Label13.Visible := True; DYer.Visible := True; end; + if Trim(FConType) = 'Ʒӹ' then + begin + Tv1Column4.Visible := True; +// DYer.Visible := True; + end; readCXgrid(self.Caption, tv1); InitData(); end; diff --git a/管理系统/U_ClothContractList_CK.dfm b/管理系统/U_ClothContractList_CK.dfm index 5f69a3d..fd03b56 100644 --- a/管理系统/U_ClothContractList_CK.dfm +++ b/管理系统/U_ClothContractList_CK.dfm @@ -60,6 +60,7 @@ object frmClothContractList_CK: TfrmClothContractList_CK AutoSize = True Caption = #26032#22686 ImageIndex = 3 + Visible = False OnClick = TBAddClick end object TBEdit: TToolButton @@ -77,6 +78,7 @@ object frmClothContractList_CK: TfrmClothContractList_CK AutoSize = True Caption = #21024#38500 ImageIndex = 17 + Visible = False OnClick = TBDelClick end object tchk: TToolButton @@ -85,6 +87,7 @@ object frmClothContractList_CK: TfrmClothContractList_CK AutoSize = True Caption = #30830#35748#23436#25104 ImageIndex = 41 + Visible = False OnClick = tchkClick end object Tnochk: TToolButton @@ -94,6 +97,7 @@ object frmClothContractList_CK: TfrmClothContractList_CK Caption = #25764#38144#23436#25104 Enabled = False ImageIndex = 56 + Visible = False OnClick = TnochkClick end object Tth: TToolButton @@ -102,6 +106,7 @@ object frmClothContractList_CK: TfrmClothContractList_CK AutoSize = True Caption = #36864#36135 ImageIndex = 129 + Visible = False OnClick = TthClick end object ToolButton1: TToolButton @@ -328,11 +333,9 @@ object frmClothContractList_CK: TfrmClothContractList_CK end item Kind = skSum - Column = v1Price end item Kind = skSum - Column = v1Money end item Kind = skSum @@ -464,7 +467,7 @@ object frmClothContractList_CK: TfrmClothContractList_CK end object v1PRTOrderQty: TcxGridDBColumn Caption = #25968#37327 - DataBinding.FieldName = 'C_Qty' + DataBinding.FieldName = 'T_Qty' HeaderAlignmentHorz = taCenter Options.Editing = False Styles.Content = cxStyle_fontclBlue @@ -480,22 +483,6 @@ object frmClothContractList_CK: TfrmClothContractList_CK Styles.Header = DataLink_TradeManage.Default Width = 47 end - object v1Price: TcxGridDBColumn - Caption = #21333#20215 - DataBinding.FieldName = 'Price' - HeaderAlignmentHorz = taCenter - Options.Editing = False - Styles.Header = DataLink_TradeManage.Default - Width = 57 - end - object v1Money: TcxGridDBColumn - Caption = #24635#20215 - DataBinding.FieldName = 'Money' - HeaderAlignmentHorz = taCenter - Options.Editing = False - Styles.Header = DataLink_TradeManage.Default - Width = 58 - end object v1Column4: TcxGridDBColumn Caption = #22791#27880 DataBinding.FieldName = 'C_Note' @@ -601,9 +588,10 @@ object frmClothContractList_CK: TfrmClothContractList_CK Height = 22 Align = alTop TabOrder = 3 + Visible = False Properties.CustomButtons.Buttons = <> Properties.Style = 9 - Properties.TabIndex = 0 + Properties.TabIndex = 2 Properties.Tabs.Strings = ( #26410#23436#25104 #24050#23436#25104 diff --git a/管理系统/U_ClothContractList_CK.pas b/管理系统/U_ClothContractList_CK.pas index 7052ef7..04a73d0 100644 --- a/管理系统/U_ClothContractList_CK.pas +++ b/管理系统/U_ClothContractList_CK.pas @@ -66,8 +66,6 @@ type v1PRTKZ: TcxGridDBColumn; v1PRTOrderQty: TcxGridDBColumn; v1OrderUnit: TcxGridDBColumn; - v1Price: TcxGridDBColumn; - v1Money: TcxGridDBColumn; cxGrid1Level1: TcxGridLevel; ClientDataSet3: TClientDataSet; DataSource2: TDataSource; @@ -198,9 +196,9 @@ begin sql.Add('exec P_Get_Contract'); sql.Add('@begdate=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + ''' '); sql.Add(',@enddate=''' + Trim(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)) + ''' '); - sql.Add(',@conType='''' '); + sql.Add(',@conType='''' '); sql.Add(',@status=''' + inttostr(cxTabControl1.TabIndex) + ''' '); -// ShowMessage(SQL.text); + ShowMessage(SQL.text); { sql.Add('select *,fromConNo=(select Top 1 conNo from Contract_Main X where X.MainID=A.fromMainID) '); sql.Add('from Contract_Main A'); sql.Add('inner join Contract_sub B on B.MainID=A.mainID '); @@ -221,39 +219,39 @@ end; procedure TfrmClothContractList_CK.InitForm(); begin - if fDParameters1 = 'ѯ' then - begin - TBADD.Visible := false; - // TBEdit.Visible:=false; - TBDel.Visible := false; - // Tchk.Visible:=false; - // TNochk.Visible:=false; - Tth.Visible := false; - v1Price.Visible := false; - v1Price.Hidden := true; - v1money.Visible := false; - v1money.Hidden := true; -// v1T_money.Visible := false; -// v1T_money.Hidden := true; - ToolButton1.Visible := false; - end; - - TBEdit.Enabled := false; - TBDel.Enabled := false; - Tchk.Enabled := false; - TNochk.Enabled := false; - Tth.Enabled := false; - if cxTabControl1.TabIndex = 0 then - begin -// TBEdit.Enabled := true; - TBDel.Enabled := true; - Tchk.Enabled := true; - Tth.Enabled := true; - end; - if cxTabControl1.TabIndex = 1 then - begin - TNochk.Enabled := true; - end; +// if fDParameters1 = 'ѯ' then +// begin +// TBADD.Visible := false; +// // TBEdit.Visible:=false; +// TBDel.Visible := false; +// // Tchk.Visible:=false; +// // TNochk.Visible:=false; +// Tth.Visible := false; +// v1Price.Visible := false; +// v1Price.Hidden := true; +// v1money.Visible := false; +// v1money.Hidden := true; +//// v1T_money.Visible := false; +//// v1T_money.Hidden := true; +// ToolButton1.Visible := false; +// end; +// +// TBEdit.Enabled := false; +// TBDel.Enabled := false; +// Tchk.Enabled := false; +// TNochk.Enabled := false; +// Tth.Enabled := false; +// if cxTabControl1.TabIndex = 0 then +// begin +//// TBEdit.Enabled := true; +// TBDel.Enabled := true; +// Tchk.Enabled := true; +// Tth.Enabled := true; +// end; +// if cxTabControl1.TabIndex = 1 then +// begin +// TNochk.Enabled := true; +// end; InitGrid(); end; @@ -307,10 +305,10 @@ begin if trim(fDParameters1) = 'ѯ' then begin frmClothContractOutPut.Caption := 'Ϣѯ'; - v1Money.Visible := false; - v1Price.Visible := false; - v1Money.Hidden := true; - v1Price.Hidden := true; +// v1Money.Visible := false; +// v1Price.Visible := false; +// v1Money.Hidden := true; +// v1Price.Hidden := true; v1T_money.Visible := false; v1T_money.Hidden := true; v1T_price.Visible := false; @@ -501,19 +499,19 @@ begin if trim(fDParameters1) = 'ѯ' then begin // frmClothContractOutPut.Caption := 'Ϣѯ'; - v1Money.Visible := false; - v1Price.Visible := false; - v1Money.Hidden := true; - v1Price.Hidden := true; +// v1Money.Visible := false; +// v1Price.Visible := false; +// v1Money.Hidden := true; +// v1Price.Hidden := true; v1T_money.Visible := false; v1T_money.Hidden := true; ScrollBox1.Enabled := false; for i := 0 to tv1.ColumnCount - 2 do - begin + begin tv1.Columns[i].Options.Editing := false; end; // v1Mrate.Options.Editing := true; - ToolBar2.Enabled := false; + ToolBar2.Enabled := false; end; PState := 0; FMainId := ''; diff --git a/管理系统/U_ClothContractList_DY.pas b/管理系统/U_ClothContractList_DY.pas index 0c05043..a59f41c 100644 --- a/管理系统/U_ClothContractList_DY.pas +++ b/管理系统/U_ClothContractList_DY.pas @@ -429,7 +429,7 @@ begin FConType := 'ƻ'; if ShowModal = 1 then begin - TBRafresh.Click; + TBRafresh.Click; end; end; finally diff --git a/管理系统/U_ClothContractList_JG.dfm b/管理系统/U_ClothContractList_JG.dfm index 006b620..c4cd1fc 100644 --- a/管理系统/U_ClothContractList_JG.dfm +++ b/管理系统/U_ClothContractList_JG.dfm @@ -536,6 +536,12 @@ object frmClothContractList_JG: TfrmClothContractList_JG Options.Editing = False Width = 80 end + object Tv1Column1: TcxGridDBColumn + Caption = #24037#33402 + DataBinding.FieldName = 'gongyi' + HeaderAlignmentHorz = taCenter + Width = 60 + end end object cxGrid1Level1: TcxGridLevel GridView = Tv1 diff --git a/管理系统/U_ClothContractList_JG.pas b/管理系统/U_ClothContractList_JG.pas index e4e0da8..061d56b 100644 --- a/管理系统/U_ClothContractList_JG.pas +++ b/管理系统/U_ClothContractList_JG.pas @@ -97,6 +97,7 @@ type v1Column10: TcxGridDBColumn; v1Column11: TcxGridDBColumn; ToolButton1: TToolButton; + Tv1Column1: TcxGridDBColumn; procedure FormDestroy(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormCreate(Sender: TObject); @@ -349,9 +350,9 @@ begin with frmClothContractInPut_Tp do begin PState := 0; - FMainId := ''; + FMainId := ''; FConType := 'Ʒӹ'; - caption := 'ӹ'; + caption := 'ӹ'; if ShowModal = 1 then begin TBRafresh.Click;