697 lines
19 KiB
ObjectPascal
697 lines
19 KiB
ObjectPascal
|
unit U_TatPlanList;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
|||
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
|||
|
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls,
|
|||
|
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|||
|
cxGrid, DBClient, cxCalendar, cxButtonEdit, cxSplitter, RM_Common, RM_Class,
|
|||
|
RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, cxTextEdit, cxLookAndFeels,
|
|||
|
cxLookAndFeelPainters, cxNavigator, dxSkinsCore, dxSkinsDefaultPainters,
|
|||
|
dxDateRanges, dxBarBuiltInMenu, U_BaseList, cxPC;
|
|||
|
|
|||
|
type
|
|||
|
TfrmTatPlanList = class(TfrmBaseList)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBEdit: TToolButton;
|
|||
|
TBDel: TToolButton;
|
|||
|
TBPrint: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
Label1: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
GPM_1: TcxGridPopupMenu;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DS_1: TDataSource;
|
|||
|
Label3: TLabel;
|
|||
|
ConNo: TEdit;
|
|||
|
Label5: TLabel;
|
|||
|
C_Name: TEdit;
|
|||
|
TBExport: TToolButton;
|
|||
|
CDS_1: TClientDataSet;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1OrderNo: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1PRTMF: TcxGridDBColumn;
|
|||
|
v1PRTKZ: TcxGridDBColumn;
|
|||
|
v1PRTOrderQty: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
TBCopy: TToolButton;
|
|||
|
TBView: TToolButton;
|
|||
|
v1Column19: TcxGridDBColumn;
|
|||
|
v1Column21: TcxGridDBColumn;
|
|||
|
Label10: TLabel;
|
|||
|
C_Code: TEdit;
|
|||
|
v1Column20: TcxGridDBColumn;
|
|||
|
v1Column31: TcxGridDBColumn;
|
|||
|
CustName: TEdit;
|
|||
|
Label7: TLabel;
|
|||
|
lbl1: TLabel;
|
|||
|
OrdType: TComboBox;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Label4: TLabel;
|
|||
|
OrderNo: TEdit;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
TBEnd: TToolButton;
|
|||
|
TBNoEnd: TToolButton;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
Tv1Column8: TcxGridDBColumn;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
Tv1Column9: TcxGridDBColumn;
|
|||
|
Tv1Column10: TcxGridDBColumn;
|
|||
|
btnChk: TToolButton;
|
|||
|
btnReChk: TToolButton;
|
|||
|
Tv1Column11: TcxGridDBColumn;
|
|||
|
Tv1Column12: TcxGridDBColumn;
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure TBFindClick(Sender: TObject);
|
|||
|
procedure TBEditClick(Sender: TObject);
|
|||
|
procedure TBDelClick(Sender: TObject);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure TBPrintClick(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure TBAddClick(Sender: TObject);
|
|||
|
procedure ConNoChange(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure conPress(Sender: TObject; var Key: Char);
|
|||
|
procedure TBViewClick(Sender: TObject);
|
|||
|
procedure TBCopyClick(Sender: TObject);
|
|||
|
procedure OrdTypeChange(Sender: TObject);
|
|||
|
procedure C_CodeKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure BatchNoHZKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure CustNameKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure C_NameKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure TBEndClick(Sender: TObject);
|
|||
|
procedure TBNoEndClick(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure btnChkClick(Sender: TObject);
|
|||
|
procedure btnReChkClick(Sender: TObject);
|
|||
|
private
|
|||
|
FInt, PFInt: Integer;
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitForm();
|
|||
|
function DelData(): Boolean;
|
|||
|
procedure InitButton();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
canshu1, FCheJian: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp, U_LabelPrint, U_TatPlanInPut, U_TatCardInPut;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmTatPlanList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.InitButton();
|
|||
|
begin
|
|||
|
|
|||
|
TBAdd.Enabled := False;
|
|||
|
TBCopy.Enabled := False;
|
|||
|
TBEdit.Enabled := False;
|
|||
|
TBDel.Enabled := False;
|
|||
|
TBEnd.Enabled := False;
|
|||
|
TBNoEnd.Enabled := False;
|
|||
|
btnChk.Enabled := False;
|
|||
|
btnReChk.Enabled := False;
|
|||
|
if Trim(canshu1) = '¼<><C2BC>' then
|
|||
|
begin
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
TBAdd.Enabled := true;
|
|||
|
TBCopy.Enabled := true;
|
|||
|
TBDel.Enabled := true;
|
|||
|
TBEdit.Enabled := true;
|
|||
|
btnChk.Enabled := true;
|
|||
|
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
TBAdd.Enabled := true;
|
|||
|
TBCopy.Enabled := true;
|
|||
|
TBEnd.Enabled := true;
|
|||
|
TBEdit.Enabled := true;
|
|||
|
btnReChk.Enabled := true;
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
TBNoEnd.Enabled := true;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(canshu1) = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
TBAdd.Enabled := true;
|
|||
|
TBCopy.Enabled := true;
|
|||
|
TBDel.Enabled := true;
|
|||
|
TBEdit.Enabled := true;
|
|||
|
btnChk.Enabled := true;
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
TBAdd.Enabled := true;
|
|||
|
TBCopy.Enabled := true;
|
|||
|
TBEnd.Enabled := true;
|
|||
|
TBEdit.Enabled := true;
|
|||
|
btnReChk.Enabled := true;
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
TBNoEnd.Enabled := true;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.*,B.* ');
|
|||
|
sql.Add(',APPS=(select count(X.MainID) from Tat_Plan_Card X where X.MainID =A.MainID and isnull(X.Status,''0'') <>''-1'' )');
|
|||
|
sql.Add(',JYPS=(select count(X.MainID) from Tat_Plan_Card X where X.MainID =A.MainID and isnull(X.Status,''0'') =''1'')');
|
|||
|
sql.Add(' from Tat_Plan_Main A inner join Tat_Plan_Sub B on A.Mainid=B.MainId');
|
|||
|
sql.Add('where 1=1 ');
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
sql.Add('and isnull(Status,''0'') =''0'' ');
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
sql.Add('and isnull(Status,''0'') =''9'' ');
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
sql.Add('and isnull(Status,''0'') =''10'' ');
|
|||
|
sql.Add(' and A.FillTIme>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + '''');
|
|||
|
sql.Add(' and A.FillTIme<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.DateTime + 1)) + '''');
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
sql.add('order by A.FILLTIME DESC');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.InitForm();
|
|||
|
begin
|
|||
|
|
|||
|
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
BegDate.DateTime := SGetServerDate(ADOQueryTemp) - 30;
|
|||
|
EndDate.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
InitButton();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.TBFindClick(Sender: TObject);
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.TBNoEndClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Tat_Plan_Main SET status=''0'',Comper=null,Comptime=null ');
|
|||
|
sql.Add('where mainID=' + quotedstr(trim(CDS_1.fieldbyname('mainID').AsString)));
|
|||
|
|
|||
|
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><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(CDS_1.FieldByName('OrderNo').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.TBEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmTatPlanInPut := TfrmTatPlanInPut.Create(Application);
|
|||
|
with frmTatPlanInPut do
|
|||
|
begin
|
|||
|
PState := 1;
|
|||
|
FMainId := Trim(Self.CDS_1.fieldbyname('MainId').AsString);
|
|||
|
FSubId := Trim(Self.CDS_1.fieldbyname('SubId').AsString);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
Self.CDS_1.Locate('MainId', frmTatPlanInPut.FMainId, []);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmTatPlanInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.TBEndClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Tat_Plan_Main SET status=''10'' ,Comper=''' + trim(DName) + ''',Comptime=getdate() ');
|
|||
|
sql.Add('where mainID=' + quotedstr(trim(CDS_1.fieldbyname('mainID').AsString)));
|
|||
|
|
|||
|
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><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(CDS_1.FieldByName('OrderNo').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.TBDelClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
Exit;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select A.*');
|
|||
|
sql.Add('from Tat_Plan_Card A');
|
|||
|
sql.Add(' where isnull(Status,''0'') <>''-1'' and A.SubId=''' + Trim(CDS_1.fieldbyname('SubId').AsString) + '''');
|
|||
|
sql.Add(' and A.MainId=''' + Trim(CDS_1.fieldbyname('MainId').AsString) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
if DelData() then
|
|||
|
begin
|
|||
|
CDS_1.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmTatPlanList.DelData(): Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
Result := false;
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete Tat_Plan_Sub where SubId=''' + Trim(CDS_1.fieldbyname('SubId').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from Tat_Plan_Sub where MainId=''' + Trim(CDS_1.fieldbyname('MainId').AsString) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete Tat_Plan_Main where MainId=''' + Trim(CDS_1.fieldbyname('MainId').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Trim(CDS_1.fieldbyname('SubId').AsString) = '' then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete Tat_Plan_Main where MainId=''' + Trim(CDS_1.fieldbyname('MainId').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Result := False;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
Exit;
|
|||
|
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', cxGrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.TBPrintClick(Sender: TObject);
|
|||
|
var
|
|||
|
WSql: string;
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
Exit;
|
|||
|
WSql := Trim(CDS_1.fieldbyname('MainId').AsString);
|
|||
|
|
|||
|
try
|
|||
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
with frmLabelPrint do
|
|||
|
begin
|
|||
|
FLMType := 'TatPlanPrint';
|
|||
|
FFiltration1 := WSql;
|
|||
|
FFiltration2 := WSql;
|
|||
|
FFiltration3 := WSql;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
// Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmLabelPrint.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.TBAddClick(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
try
|
|||
|
frmTatPlanInPut := TfrmTatPlanInPut.Create(Application);
|
|||
|
with frmTatPlanInPut do
|
|||
|
begin
|
|||
|
PState := 0;
|
|||
|
FMainId := '';
|
|||
|
FSubId := '';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmTatPlanInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.ConNoChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
canshu1 := DParameters1;
|
|||
|
InitForm();
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.conPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
if Length(Trim(ConNo.Text)) < 4 then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
//sql.Add('exec Tat_Plan_QryList :MainId,:WSql');
|
|||
|
// Parameters.ParamByName('WSql').Value:=' and OM.conNo like '''+'%'+Trim(ConNoM.Text)+'%'+''''
|
|||
|
// +' and ConType=''<27><><EFBFBD><EFBFBD>'' ';
|
|||
|
sql.Add('select * from Tat_Plan_Main A inner join Tat_Plan_Sub B on A.Mainid=B.MainId');
|
|||
|
sql.Add(' where A.ConNo like ''' + '%' + Trim(ConNo.Text) + '%' + '''');
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.TBViewClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmTatPlanInPut := TfrmTatPlanInPut.Create(Application);
|
|||
|
with frmTatPlanInPut do
|
|||
|
begin
|
|||
|
PState := 1;
|
|||
|
FMainId := Trim(Self.CDS_1.fieldbyname('MainId').AsString);
|
|||
|
FSubId := Trim(Self.CDS_1.fieldbyname('SubId').AsString);
|
|||
|
FConNo := Trim(Self.CDS_1.fieldbyname('ConNo').AsString);
|
|||
|
TBSave.Visible := False;
|
|||
|
ToolBar3.Visible := False;
|
|||
|
ScrollBox1.Enabled := False;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmTatPlanInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.btnChkClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Tat_Plan_Main SET status=''9'',chker=''' + trim(DName) + ''',Chktime=getdate() ');
|
|||
|
sql.Add('where mainID=' + quotedstr(trim(CDS_1.fieldbyname('mainID').AsString)));
|
|||
|
|
|||
|
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><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(CDS_1.FieldByName('OrderNo').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
application.MessageBox('<27><>ʼ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
application.MessageBox('<27><>ʼʧ<CABC>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.btnReChkClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
if cxTabControl1.TabIndex <> 2 then
|
|||
|
begin
|
|||
|
Application.MessageBox('ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD>ѿ<EFBFBD>ʼ״̬<D7B4>½<EFBFBD><C2BD>к˲<D0BA><CBB2><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Tat_Plan_Main SET status=''0'',chker=null,Chktime=null ');
|
|||
|
sql.Add('where mainID=' + quotedstr(trim(CDS_1.fieldbyname('mainID').AsString)));
|
|||
|
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><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(CDS_1.FieldByName('OrderNo').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
application.MessageBox('<27>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼʧ<CABC>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.TBCopyClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmTatPlanInPut := TfrmTatPlanInPut.Create(Application);
|
|||
|
with frmTatPlanInPut do
|
|||
|
begin
|
|||
|
PState := 1;
|
|||
|
FCopyInt := 1;
|
|||
|
FMainId := Trim(Self.CDS_1.fieldbyname('MainId').AsString);
|
|||
|
FConNo := Trim(Self.CDS_1.fieldbyname('ConNo').AsString);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmTatPlanInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.OrdTypeChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.C_CodeKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
TBRafresh.Click();
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.BatchNoHZKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
TBRafresh.Click();
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.CustNameKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
TBRafresh.Click();
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
InitButton();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTatPlanList.C_NameKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
TBRafresh.Click();
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|