297 lines
8.2 KiB
ObjectPascal
297 lines
8.2 KiB
ObjectPascal
unit U_DyeFormulaSampleList;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
||
cxEdit, DB, cxDBData, cxTextEdit, cxCheckBox, cxCurrencyEdit, BtnEdit,
|
||
cxContainer, cxGridLevel, cxGridCustomTableView, cxGridTableView,
|
||
cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, StdCtrls,
|
||
ComCtrls, ExtCtrls, ToolWin, ADODB, cxMaskEdit, cxDropDownEdit, Menus,
|
||
cxLookAndFeelPainters, cxButtons, DBClient, cxButtonEdit, cxLookAndFeels,
|
||
cxNavigator, RM_System, RM_Dataset, RM_Common, RM_Class, RM_GridReport,
|
||
dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, U_BaseList, RM_BarCode,
|
||
dxBarBuiltInMenu, cxGridCustomPopupMenu, cxGridPopupMenu;
|
||
|
||
type
|
||
TfrmDyeFormulaSampleList = class(TfrmBaseList)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBADD: TToolButton;
|
||
TBedit: TToolButton;
|
||
TBdel: TToolButton;
|
||
TBexcpet: TToolButton;
|
||
TBclose: TToolButton;
|
||
Panel5: TPanel;
|
||
Label1: TLabel;
|
||
Label3: TLabel;
|
||
Label4: TLabel;
|
||
Label6: TLabel;
|
||
Label5: TLabel;
|
||
Label10: TLabel;
|
||
Label11: TLabel;
|
||
begdate: TDateTimePicker;
|
||
C_ColorNo: TEdit;
|
||
enddate: TDateTimePicker;
|
||
C_Color: TEdit;
|
||
custName: TEdit;
|
||
C_Code: TEdit;
|
||
cbDept: TComboBox;
|
||
cxgrid1: TcxGrid;
|
||
TV1: TcxGridDBTableView;
|
||
TV1RcvDate: TcxGridDBColumn;
|
||
TV1ShortName: TcxGridDBColumn;
|
||
TV1GreyCons: TcxGridDBColumn;
|
||
TV1Lights: TcxGridDBColumn;
|
||
TV1Remark: TcxGridDBColumn;
|
||
TV1SplType: TcxGridDBColumn;
|
||
TV1DlvDate: TcxGridDBColumn;
|
||
TV1FillorName: TcxGridDBColumn;
|
||
TV1YWYName: TcxGridDBColumn;
|
||
TV1CuSplCode: TcxGridDBColumn;
|
||
TV1Request: TcxGridDBColumn;
|
||
cxgrid1L1: TcxGridLevel;
|
||
DS_Main: TDataSource;
|
||
V1Column1: TcxGridDBColumn;
|
||
V1Column2: TcxGridDBColumn;
|
||
V1Column3: TcxGridDBColumn;
|
||
V1Column4: TcxGridDBColumn;
|
||
V1Column5: TcxGridDBColumn;
|
||
V1Column8: TcxGridDBColumn;
|
||
V1Column9: TcxGridDBColumn;
|
||
TBFind: TToolButton;
|
||
CDS_Main: TClientDataSet;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
ToolButton3: TToolButton;
|
||
ADO_Print: TADOQuery;
|
||
TV1Column3: TcxGridDBColumn;
|
||
ToolButton1: TToolButton;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure TBADDClick(Sender: TObject);
|
||
procedure TBeditClick(Sender: TObject);
|
||
procedure TBdelClick(Sender: TObject);
|
||
procedure TBcloseClick(Sender: TObject);
|
||
procedure TBexcpetClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure TV1Column3PropertiesEditValueChanged(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
private
|
||
procedure InitGrid();
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmDyeFormulaSampleList: TfrmDyeFormulaSampleList;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_DyeFormulaSampleInput, U_LabelPrint;
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmDyeFormulaSampleList.InitGrid();
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
close;
|
||
Filtered := False;
|
||
sql.Clear;
|
||
sql.Add('select * ');
|
||
sql.Add('from Dye_Formula_Sample_Sub A ');
|
||
sql.Add('inner join Dye_Formula_Sample_Main B on B.DFSMID=A.DFSMID');
|
||
sql.Add('where Filltime>=''' + formatdateTime('yyyy-MM-dd', begdate.dateTime) + ''' ');
|
||
sql.Add('and Filltime<''' + formatdateTime('yyyy-MM-dd', enddate.DateTime + 1) + ''' ');
|
||
open;
|
||
end;
|
||
SCreateCDS(ADOQueryMain, CDS_Main);
|
||
SInitCDSData(ADOQueryMain, CDS_Main);
|
||
end;
|
||
|
||
procedure TfrmDyeFormulaSampleList.FormCreate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
|
||
enddate.DateTime := SGetServerDate(ADOQueryTemp);
|
||
begdate.DateTime := enddate.DateTime - 30;
|
||
end;
|
||
|
||
procedure TfrmDyeFormulaSampleList.FormDestroy(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmDyeFormulaSampleList := nil;
|
||
end;
|
||
|
||
procedure TfrmDyeFormulaSampleList.TBADDClick(Sender: TObject);
|
||
begin
|
||
|
||
frmDyeFormulaSampleInput := TfrmDyeFormulaSampleInput.create(self);
|
||
with frmDyeFormulaSampleInput do
|
||
begin
|
||
FDFSMID := '';
|
||
if showmodal = 1 then
|
||
begin
|
||
|
||
end;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyeFormulaSampleList.TBeditClick(Sender: TObject);
|
||
begin
|
||
|
||
frmDyeFormulaSampleInput := TfrmDyeFormulaSampleInput.create(self);
|
||
with frmDyeFormulaSampleInput do
|
||
begin
|
||
FDFSMID := trim(CDS_Main.fieldbyName('DFSMID').AsString);
|
||
if showmodal = 1 then
|
||
begin
|
||
end;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyeFormulaSampleList.TBdelClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
with AdoqueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
|
||
sql.Add('update Dye_Formula_Sample_Main set DelId=' + quotedstr(DCode) + ',Deler=' + quotedstr(DName) + ',Deltime=getdate() where DFSMID=' + quotedstr(trim(CDS_Main.fieldByName('DFSMID').AsString)));
|
||
sql.Add('insert into Dye_Formula_Sample_Main_Del select * from Dye_Formula_Sample_Main where DFSMID=' + quotedstr(trim(CDS_Main.fieldByName('DFSMID').AsString)));
|
||
sql.Add('delete Dye_Formula_Sample_Main where DFSMID=' + quotedstr(trim(CDS_Main.fieldByName('DFSMID').AsString)));
|
||
|
||
sql.Add('update Dye_Formula_Sample_Sub set DelId=' + quotedstr(DCode) + ',Deler=' + quotedstr(DName) + ',Deltime=getdate() where DFSMID=' + quotedstr(trim(CDS_Main.fieldByName('DFSMID').AsString)));
|
||
sql.Add('insert into Dye_Formula_Sample_Sub_Del select * from Dye_Formula_Sample_Sub where DFSMID=' + quotedstr(trim(CDS_Main.fieldByName('DFSMID').AsString)));
|
||
sql.Add('delete Dye_Formula_Sample_Sub where DFSMID=' + quotedstr(trim(CDS_Main.fieldByName('DFSMID').AsString)));
|
||
|
||
execsql;
|
||
end;
|
||
execsql;
|
||
end;
|
||
initgrid();
|
||
except
|
||
application.MessageBox('ɾ<><C9BE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyeFormulaSampleList.TBcloseClick(Sender: TObject);
|
||
begin
|
||
close;
|
||
end;
|
||
|
||
procedure TfrmDyeFormulaSampleList.TBexcpetClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
TcxGridToExcel(self.Caption, cxgrid1);
|
||
end;
|
||
|
||
procedure TfrmDyeFormulaSampleList.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
readCxGrid(self.Caption + tv1.Name, Tv1, 'С<><D0A1><EFBFBD>䷽');
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmDyeFormulaSampleList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmDyeFormulaSampleList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := cafree;
|
||
end;
|
||
|
||
procedure TfrmDyeFormulaSampleList.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
//showessage(SGetFilters(Panel5,1,2));
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel5, 1, 2));
|
||
SCreateCDS(ADOQueryMain, CDS_Main);
|
||
SInitCDSData(ADOQueryMain, CDS_Main);
|
||
end;
|
||
|
||
procedure TfrmDyeFormulaSampleList.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(self.Caption + tv1.Name, Tv1, 'С<><D0A1><EFBFBD>䷽');
|
||
end;
|
||
|
||
procedure TfrmDyeFormulaSampleList.ToolButton3Click(Sender: TObject);
|
||
var
|
||
WSql: string;
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
WSql := QuotedStr(Trim(CDS_Main.fieldbyname('DFSMID').AsString));
|
||
try
|
||
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
||
with frmLabelPrint do
|
||
begin
|
||
FLMType := 'DyeFormulaSample';
|
||
FFiltration1 := WSql;
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmLabelPrint.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmDyeFormulaSampleList.TV1Column3PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
|
||
with CDS_Main do
|
||
begin
|
||
Edit;
|
||
FieldByName('PH').Value := Trim(mvalue);
|
||
Post;
|
||
end;
|
||
|
||
try
|
||
with AdoqueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Dye_Formula_Sample_Sub SET PH=''' + trim(mvalue) + ''' where DFSMID=''' + trim(CDS_main.fieldbyName('DFSMID').AsString) + '''');
|
||
sql.Add('and fsNo=''' + trim(CDS_main.fieldbyName('fsNo').AsString) + '''');
|
||
execsql;
|
||
end;
|
||
except
|
||
|
||
end;
|
||
|
||
self.tv1.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
end.
|
||
|