631 lines
19 KiB
ObjectPascal
631 lines
19 KiB
ObjectPascal
![]() |
unit U_CPKWHZ;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
ComObj, Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB,
|
|||
|
ADODB, cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin,
|
|||
|
StdCtrls, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
|||
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
|||
|
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
|||
|
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
|||
|
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
|||
|
IdTCPClient, IdFTP, ShellAPI, IniFiles, cxCheckBox, cxCalendar, cxButtonEdit,
|
|||
|
cxTextEdit, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore,
|
|||
|
dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee,
|
|||
|
dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle,
|
|||
|
dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast,
|
|||
|
dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky,
|
|||
|
dxSkinMcSkin, dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins,
|
|||
|
dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
|
|||
|
dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
|
|||
|
dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
|
|||
|
dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven,
|
|||
|
dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver,
|
|||
|
dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld,
|
|||
|
dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
|
|||
|
dxSkinXmas2008Blue, dxSkinscxPCPainter;
|
|||
|
|
|||
|
type
|
|||
|
FdDy = record
|
|||
|
inc: integer; //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><D7BD>־<EFBFBD><D6BE><EFBFBD>
|
|||
|
FDdys: string[32]; //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><D7BD><EFBFBD>
|
|||
|
FdDysName: string[32]; //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><D7BD><EFBFBD>
|
|||
|
end;
|
|||
|
|
|||
|
TfrmCPKWHZ = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBDel: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
Panel1: TPanel;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
Label3: TLabel;
|
|||
|
defstr1: TEdit;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
Tv2: TcxGridDBTableView;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
DS_HZ: TDataSource;
|
|||
|
CDS_HZ: TClientDataSet;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
v2Column6: TcxGridDBColumn;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
v2Column3: TcxGridDBColumn;
|
|||
|
Label1: TLabel;
|
|||
|
ZdyCode: TEdit;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
v2Column8: TcxGridDBColumn;
|
|||
|
Label2: TLabel;
|
|||
|
DEFstr3: TComboBox;
|
|||
|
v2Column10: TcxGridDBColumn;
|
|||
|
v2Column11: TcxGridDBColumn;
|
|||
|
v2Column12: TcxGridDBColumn;
|
|||
|
v2Column13: TcxGridDBColumn;
|
|||
|
defstr2: TEdit;
|
|||
|
Label4: TLabel;
|
|||
|
v2Column2: TcxGridDBColumn;
|
|||
|
v2Column4: TcxGridDBColumn;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
v2Column5: TcxGridDBColumn;
|
|||
|
ToolButton6: TToolButton;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
CheckBox1: TCheckBox;
|
|||
|
ToolButton7: TToolButton;
|
|||
|
IdFTP1: TIdFTP;
|
|||
|
OpenDialog1: TOpenDialog;
|
|||
|
Tv2Column1: TcxGridDBColumn;
|
|||
|
Tv2Column2: TcxGridDBColumn;
|
|||
|
Tv2Column3: TcxGridDBColumn;
|
|||
|
Tv2Column4: TcxGridDBColumn;
|
|||
|
ToolButton8: TToolButton;
|
|||
|
GG: TEdit;
|
|||
|
Label5: TLabel;
|
|||
|
KH: TEdit;
|
|||
|
Label6: TLabel;
|
|||
|
Label7: TLabel;
|
|||
|
CKLX: TComboBox;
|
|||
|
Tv2Column5: TcxGridDBColumn;
|
|||
|
Tv2Column6: TcxGridDBColumn;
|
|||
|
Label8: TLabel;
|
|||
|
DDH: TEdit;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
CheckBox2: TCheckBox;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
ToolButton9: TToolButton;
|
|||
|
Tv2Column7: TcxGridDBColumn;
|
|||
|
Tv2Column8: TcxGridDBColumn;
|
|||
|
Label9: TLabel;
|
|||
|
QRCZ: TComboBox;
|
|||
|
ToolButton10: TToolButton;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure TBDelClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure defstr1Change(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
procedure CheckBox1Click(Sender: TObject);
|
|||
|
procedure ToolButton7Click(Sender: TObject);
|
|||
|
procedure ToolButton8Click(Sender: TObject);
|
|||
|
procedure ToolButton9Click(Sender: TObject);
|
|||
|
procedure Tv2CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
procedure ToolButton10Click(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
procedure InitGrid();
|
|||
|
public
|
|||
|
dFdDy: array[0..20] of FdDy; //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmCPKWHZ: TfrmCPKWHZ;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun, U_ZDYHelp, U_CPKWEdit, U_CPKWKCList, U_SysLogOrderzsd,U_CPKWList;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.add(' select A.DEFstr1,A.DEFstr2,isnull(A.ddh,'''')as DDH,DDqty=(select sum(Qty) from KH_Zdy_Attachment X where isnull(X.DDH,'''')=isnull(A.ddh,'''')) ');
|
|||
|
SQL.Add(' from KH_Zdy_Attachment A where Type=''CPKW'' and sczt<>1 group by A.DEFstr1,A.DEFstr2,isnull(A.ddh,'''')');
|
|||
|
// sql.Add(' select A.*, '); A.ZdyName,A.ZdyCode,
|
|||
|
// sql.Add(' cpRollNum=(select count(MJID) from CK_BanCP_KC X where X.KCKW=A.zdyCode and X.kcQty>0),');
|
|||
|
// sql.Add(' cpQty=(select sum(kcQty) from CK_BanCP_KC X where X.KCKW=A.zdyCode and X.kcQty>0 and mjid NOT like ''%C%'') ');
|
|||
|
// sql.Add(' from KH_Zdy_Attachment A ');
|
|||
|
// sql.Add(' where Type=''CPKW'' and sczt<>1');
|
|||
|
// sql.Add('and A.FillTime>=''' + FormatDateTime('yyyy-MM-dd', BegDate.DateTime) + ''' ');
|
|||
|
// sql.Add('and A.FillTime<''' + FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1) + ''' ');
|
|||
|
// ShowMessage(sql.text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_HZ);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_HZ);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
ToolButton2.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmCPKWHZ := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(self.Caption, Tv2, '<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>1');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.TBDelClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_HZ.IsEmpty then
|
|||
|
Exit;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
CDS_HZ.DisableControls;
|
|||
|
with CDS_HZ do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_HZ.FieldByName('SSel').AsBoolean = True then
|
|||
|
begin
|
|||
|
if Trim(CDS_HZ.fieldbyname('ATID').AsString) <> '' then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
if Trim(DParameters1) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
begin
|
|||
|
sql.Add('Update KH_Zdy_Attachment Set ZT=''ɾ<><C9BE>'' ');
|
|||
|
sql.Add('where ATID=''' + Trim(CDS_HZ.fieldbyname('ATID').AsString) + '''');
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
sql.Add('Update KH_Zdy_Attachment Set sczt=1,ZT=''ɾ<><C9BE>'' '); //1<>Ǽ<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
sql.Add('where ATID=''' + Trim(CDS_HZ.fieldbyname('ATID').AsString) + '''');
|
|||
|
end;
|
|||
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
sql.Add(',getdate() ');
|
|||
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>λɾ<CEBB><C9BE>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(CDS_HZ.FieldByName('ATID').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
// sql.Add('delete KH_Zdy_Attachment where ATID=''' + Trim(CDS_HZ.fieldbyname('ATID').AsString) + '''');
|
|||
|
// sql.Add('delete KH_Zdy where ZdyNo=''' + Trim(CDS_HZ.fieldbyname('ATID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
CDS_HZ.Delete;
|
|||
|
end
|
|||
|
else
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_HZ.EnableControls;
|
|||
|
|
|||
|
// if Trim(CDS_HZ.fieldbyname('ATID').AsString) <> '' then
|
|||
|
// begin
|
|||
|
// with ADOQueryCmd do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// SQL.Clear;
|
|||
|
// sql.Add('delete KH_Zdy_Attachment where ATID=''' + Trim(CDS_HZ.fieldbyname('ATID').AsString) + '''');
|
|||
|
// sql.Add('delete KH_Zdy where ZdyNo=''' + Trim(CDS_HZ.fieldbyname('ATID').AsString) + '''');
|
|||
|
// ExecSQL;
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// CDS_HZ.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
cxGrid2.Align := alclient;
|
|||
|
ReadCxGrid(self.Caption, Tv2, '<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>1');
|
|||
|
if Trim(DParameters1) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
begin
|
|||
|
ToolButton8.Visible := false;
|
|||
|
// TBDel.Visible := false;
|
|||
|
// ToolButton3.Visible := false;
|
|||
|
// ToolButton4.Visible := false;
|
|||
|
ToolButton9.Visible := False;
|
|||
|
ToolButton10.Visible := False;
|
|||
|
end;
|
|||
|
BegDate.DateTime := SGetServerDate10(ADOQueryTemp) - 1;
|
|||
|
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_HZ);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_HZ);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.defstr1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
ToolButton2.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
Exit;
|
|||
|
TcxGridToExcel(self.Caption, cxgrid2);
|
|||
|
// SelExportData(Tv2,ADOQueryMain,'<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmCPKWEdit := TfrmCPKWEdit.Create(Application);
|
|||
|
with frmCPKWEdit do
|
|||
|
begin
|
|||
|
FCYID := Trim(Self.CDS_HZ.fieldbyname('ATID').AsString);
|
|||
|
XZdyCode := Trim(Self.CDS_HZ.fieldbyname('ZdyCode').AsString);
|
|||
|
Xqty := Trim(Self.CDS_HZ.fieldbyname('qty').AsString);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCPKWEdit.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmCPKWEdit := TfrmCPKWEdit.Create(Application);
|
|||
|
with frmCPKWEdit do
|
|||
|
begin
|
|||
|
FCYID := '';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCPKWEdit.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.ToolButton5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
// frmCPKWKCList := TfrmCPKWKCList.create(self);
|
|||
|
// with frmCPKWKCList do
|
|||
|
// begin
|
|||
|
// fkeyNO := CDS_HZ.fieldbyname('zdyCode').AsString;
|
|||
|
// showmodal;
|
|||
|
// free;
|
|||
|
// end;
|
|||
|
frmCPKWList := TfrmCPKWList.create(self);
|
|||
|
with frmCPKWList do
|
|||
|
begin
|
|||
|
fkeyNO := Self.CDS_HZ.fieldbyname('DDh').AsString;
|
|||
|
showmodal;
|
|||
|
free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.ToolButton6Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
begin
|
|||
|
if CDS_HZ.IsEmpty then
|
|||
|
Exit;
|
|||
|
if CDS_HZ.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
CDS_HZ.DisableControls;
|
|||
|
with CDS_HZ do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_HZ.FieldByName('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select A.* ');
|
|||
|
sql.Add(' from KH_Zdy_Attachment A');
|
|||
|
SQL.Add(' where ATID=''' + Trim(CDS_HZ.fieldbyname('ATID').AsString) + '''');
|
|||
|
SQL.Add(' and Type=''CPKW'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := Trim(ADOQueryPrint.fieldbyname('ATID').AsString);
|
|||
|
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
|
|||
|
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
|||
|
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
|||
|
if FileExists(fImagePath) then
|
|||
|
DeleteFile(fImagePath);
|
|||
|
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
CDS_HZ.EnableControls;
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><>Ʒ<EFBFBD><C6B7>λ<EFBFBD><CEBB>ǩ.rmf';
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
// RM1.ShowReport;
|
|||
|
RM1.PrintReport;
|
|||
|
sleep(200);
|
|||
|
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
CDS_HZ.EnableControls;
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + trim(fPrintFile)), '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_HZ.EnableControls;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.CheckBox1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_HZ, checkbox1.Checked);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.ToolButton7Click(Sender: TObject);
|
|||
|
var
|
|||
|
excelApp, WorkBook: Variant;
|
|||
|
i, j, k, ExcelRowCount: integer;
|
|||
|
maxId: string;
|
|||
|
begin
|
|||
|
|
|||
|
try
|
|||
|
excelApp := CreateOleObject('Excel.Application');
|
|||
|
openDialog1.Filter := '*.CSV;*.xls';
|
|||
|
if opendialog1.Execute then
|
|||
|
begin
|
|||
|
WorkBook := excelApp.WorkBooks.Open(OpenDialog1.FileName);
|
|||
|
end
|
|||
|
else
|
|||
|
exit;
|
|||
|
|
|||
|
excelApp.Visible := false;
|
|||
|
ExcelRowCount := WorkBook.WorkSheets[1].UsedRange.Rows.Count;
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>EXCEL<45><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
k := 0;
|
|||
|
for i := 1 to 20 do
|
|||
|
begin
|
|||
|
if trim(excelApp.Cells[1, i].value) = '' then
|
|||
|
break;
|
|||
|
if trim(excelApp.Cells[1, i].value) = '<27><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
dFdDy[k].inc := i;
|
|||
|
dFdDy[k].FDdys := 'ZdyCode';
|
|||
|
dFdDy[k].FdDysName := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>';
|
|||
|
end;
|
|||
|
k := k + 1;
|
|||
|
end;
|
|||
|
except
|
|||
|
end;
|
|||
|
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
try
|
|||
|
for i := 2 to ExcelRowCount do
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd, maxId, 'KW', 'KH_Zdy_Attachment', 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('select * from KH_Zdy_Attachment where 1=2');
|
|||
|
open;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Append;
|
|||
|
for j := 0 to k - 1 do
|
|||
|
begin
|
|||
|
if trim(dFdDy[j].FDdys) <> '' then
|
|||
|
ADOQueryCmd.fieldbyname(dFdDy[j].FDdys).Value := excelApp.Cells[i, dFdDy[j].inc].Value;
|
|||
|
end;
|
|||
|
ADOQueryCmd.FieldByName('ATID').Value := Trim(maxId);
|
|||
|
ADOQueryCmd.FieldByName('ZdyName').Value := Trim(ADOQueryCmd.fieldbyname('ZdyCode').AsString);
|
|||
|
// ADOQueryCmd.FieldByName('khType').Value:=Trim(fkhType);
|
|||
|
ADOQueryCmd.FieldByName('Type').Value := 'CPKW';
|
|||
|
ADOQueryCmd.FieldByName('Filler').Value := Trim(DName);
|
|||
|
ADOQueryCmd.Post;
|
|||
|
|
|||
|
end;
|
|||
|
WorkBook.Close;
|
|||
|
excelApp.Quit;
|
|||
|
excelApp := Unassigned;
|
|||
|
WorkBook := Unassigned;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
WorkBook.Close;
|
|||
|
excelApp.Quit;
|
|||
|
excelApp := Unassigned;
|
|||
|
WorkBook := Unassigned;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.ToolButton8Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_HZ.IsEmpty then
|
|||
|
Exit;
|
|||
|
if CDS_HZ.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
CDS_HZ.DisableControls;
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_HZ do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_HZ.FieldByName('SSel').AsBoolean = True then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update KH_Zdy_Attachment Set CKLX=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add('where ATID=''' + Trim(CDS_HZ.fieldbyname('ATID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
CDS_HZ.EnableControls;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
CDS_HZ.EnableControls;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.ToolButton9Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_HZ.IsEmpty then
|
|||
|
Exit;
|
|||
|
if CDS_HZ.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
CDS_HZ.DisableControls;
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_HZ do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_HZ.FieldByName('SSel').AsBoolean = True then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update KH_Zdy_Attachment Set QRCZ=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add('where ATID=''' + Trim(CDS_HZ.fieldbyname('ATID').AsString) + '''');
|
|||
|
if Trim(CDS_HZ.fieldbyname('zt').AsString) = 'ɾ<><C9BE>' then //<2F><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>
|
|||
|
begin
|
|||
|
sql.Add('Update KH_Zdy_Attachment Set sczt=1 ');
|
|||
|
sql.Add('where ATID=''' + Trim(CDS_HZ.fieldbyname('ATID').AsString) + '''');
|
|||
|
end;
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
CDS_HZ.EnableControls;
|
|||
|
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
CDS_HZ.EnableControls;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.Tv2CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
if AViewInfo.GridRecord.Values[tv2.GetColumnByFieldName('QRCZ').Index] = 'δ<><CEB4><EFBFBD><EFBFBD>' then
|
|||
|
ACanvas.Brush.Color := clRed;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCPKWHZ.ToolButton10Click(Sender: TObject);
|
|||
|
begin
|
|||
|
frmSysLogOrderzsd := TfrmSysLogOrderzsd.create(self);
|
|||
|
with frmSysLogOrderzsd do
|
|||
|
begin
|
|||
|
fModel := self.caption;
|
|||
|
// frmSysLogOrderzsd.FMainId := Trim(Self.FMainId);
|
|||
|
showmodal;
|
|||
|
free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|