2025-11-14 15:11:06 +08:00
|
|
|
|
unit U_TatClothCKHZList;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
|
|
|
|
|
cxEdit, DB, cxDBData, cxGridCustomTableView, cxGridTableView,
|
|
|
|
|
|
cxGridBandedTableView, cxGridDBBandedTableView, cxGridLevel, cxClasses,
|
|
|
|
|
|
cxControls, cxGridCustomView, cxGridDBTableView, cxGrid, StdCtrls, ComCtrls,
|
|
|
|
|
|
ExtCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, ADODB, DBClient,
|
|
|
|
|
|
cxDropDownEdit, cxCheckBox, RM_Common, RM_Class, RM_e_Xls, RM_Dataset,
|
|
|
|
|
|
RM_System, RM_GridReport, Menus, cxCalendar, MovePanel, Math, Clipbrd,
|
|
|
|
|
|
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, cxTextEdit, dxSkinsCore,
|
|
|
|
|
|
dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, U_BaseList, cxPC,
|
2025-12-09 17:30:02 +08:00
|
|
|
|
System.StrUtils, dxScrollbarAnnotations;
|
2025-11-14 15:11:06 +08:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TfrmTatClothCKHZList = class(TfrmBaseList)
|
|
|
|
|
|
ToolBar1: TToolBar;
|
|
|
|
|
|
TBRafresh: TToolButton;
|
|
|
|
|
|
TBExport: TToolButton;
|
|
|
|
|
|
TBClose: TToolButton;
|
|
|
|
|
|
Panel1: TPanel;
|
|
|
|
|
|
ADOQueryCmd: TADOQuery;
|
|
|
|
|
|
ADOQueryMain: TADOQuery;
|
|
|
|
|
|
ADOQueryTemp: TADOQuery;
|
|
|
|
|
|
DS_1: TDataSource;
|
|
|
|
|
|
GPM_1: TcxGridPopupMenu;
|
|
|
|
|
|
Label2: TLabel;
|
|
|
|
|
|
BegDate: TDateTimePicker;
|
|
|
|
|
|
EndDate: TDateTimePicker;
|
|
|
|
|
|
CDS_1: TClientDataSet;
|
|
|
|
|
|
begtime: TDateTimePicker;
|
|
|
|
|
|
endTime: TDateTimePicker;
|
|
|
|
|
|
IsJYTime: TCheckBox;
|
|
|
|
|
|
ToolButton4: TToolButton;
|
|
|
|
|
|
cxGrid1: TcxGrid;
|
|
|
|
|
|
Tv1: TcxGridDBTableView;
|
|
|
|
|
|
v1Column22: TcxGridDBColumn;
|
|
|
|
|
|
v1Column23: TcxGridDBColumn;
|
|
|
|
|
|
v1Column10: TcxGridDBColumn;
|
|
|
|
|
|
Tv1Column3: TcxGridDBColumn;
|
|
|
|
|
|
cxGrid1Level1: TcxGridLevel;
|
|
|
|
|
|
Label5: TLabel;
|
|
|
|
|
|
C_Name: TEdit;
|
|
|
|
|
|
PM_1: TPopupMenu;
|
|
|
|
|
|
PM11: TMenuItem;
|
|
|
|
|
|
N1: TMenuItem;
|
|
|
|
|
|
cxTabControl1: TcxTabControl;
|
2025-12-09 17:30:02 +08:00
|
|
|
|
Tv1DRMID: TcxGridDBColumn;
|
|
|
|
|
|
Tv1ToCoName: TcxGridDBColumn;
|
|
|
|
|
|
Tv1C_Width: TcxGridDBColumn;
|
|
|
|
|
|
Tv1C_GramWeight: TcxGridDBColumn;
|
|
|
|
|
|
Tv1NetWeight: TcxGridDBColumn;
|
|
|
|
|
|
Tv1PF: TcxGridDBColumn;
|
|
|
|
|
|
Tv1IOTime: TcxGridDBColumn;
|
2025-11-14 15:11:06 +08:00
|
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
|
|
|
procedure FormCreate(Sender: TObject);
|
|
|
|
|
|
procedure TBRafreshClick(Sender: TObject);
|
|
|
|
|
|
procedure ConNoMChange(Sender: TObject);
|
|
|
|
|
|
procedure TBCloseClick(Sender: TObject);
|
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
|
procedure TBExportClick(Sender: TObject);
|
|
|
|
|
|
procedure orderNoKeyPress(Sender: TObject; var Key: Char);
|
|
|
|
|
|
procedure BTNPClick(Sender: TObject);
|
|
|
|
|
|
procedure BTLPClick(Sender: TObject);
|
|
|
|
|
|
procedure TCBNORChange(Sender: TObject);
|
|
|
|
|
|
procedure JYTypeChange(Sender: TObject);
|
|
|
|
|
|
procedure ToolButton2Click(Sender: TObject);
|
|
|
|
|
|
procedure cxPageControl1Change(Sender: TObject);
|
|
|
|
|
|
procedure CDS_1BeforeOpen(DataSet: TDataSet);
|
|
|
|
|
|
procedure Tv1DataControllerFilterBeforeChange(Sender: TcxDBDataFilterCriteria; ADataSet: TDataSet; const AFilterText: string);
|
|
|
|
|
|
|
|
|
|
|
|
procedure Tv1TcxGridDBDataControllerTcxDataSummaryFooterSummaryItems6GetText(Sender: TcxDataSummaryItem; const AValue: Variant; AIsFooter: Boolean; var AText: string);
|
|
|
|
|
|
procedure ToolButton4Click(Sender: TObject);
|
|
|
|
|
|
procedure PM11Click(Sender: TObject);
|
|
|
|
|
|
procedure N1Click(Sender: TObject);
|
|
|
|
|
|
procedure IsJYTimeClick(Sender: TObject);
|
|
|
|
|
|
procedure C_NameKeyPress(Sender: TObject; var Key: Char);
|
|
|
|
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|
|
|
|
|
private
|
|
|
|
|
|
CurrentPage, RecordsNumber: Integer;
|
|
|
|
|
|
lstCust: TStringList;
|
|
|
|
|
|
procedure InitGrid();
|
|
|
|
|
|
procedure SetStatus();
|
|
|
|
|
|
{ Private declarations }
|
|
|
|
|
|
public
|
|
|
|
|
|
canshu1: string;
|
|
|
|
|
|
{ Public declarations }
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
U_DataLink, U_RTFun, U_LabelPrint;
|
|
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.SetStatus();
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
FreeAndNil(lstCust);
|
|
|
|
|
|
Action := caFree;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.FormCreate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
lstCust := TStringList.Create;
|
|
|
|
|
|
EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
|
|
|
|
|
BegDate.DateTime := EndDate.DateTime - 20;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.InitGrid();
|
|
|
|
|
|
var
|
|
|
|
|
|
WSql: string;
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
WSql := SGetFilters(Panel1, 1, 2);
|
|
|
|
|
|
if Trim(WSql) <> '' then
|
|
|
|
|
|
WSql := ' and ' + WSql;
|
|
|
|
|
|
if IsJYTime.Checked then
|
|
|
|
|
|
begin
|
2025-12-09 17:30:02 +08:00
|
|
|
|
WSql := WSql + ' and A.IOTime>=' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime));
|
|
|
|
|
|
WSql := WSql + ' and A.IOTime<' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1));
|
2025-11-14 15:11:06 +08:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
ADOQueryMain.DisableControls;
|
|
|
|
|
|
|
|
|
|
|
|
with ADOQueryMain do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Filtered := False;
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
|
2025-12-09 17:30:02 +08:00
|
|
|
|
sql.Add('SELECT A.C_CODE,A.C_Name,A.C_Width,A.C_GramWeight,A.IONo ');
|
|
|
|
|
|
sql.Add(',ToCoName=max(B.ToCoName),ioTime=min(ioTime) ');
|
|
|
|
|
|
sql.Add(' ,js = count(*),Meter=sum(A.meter),NetWeight = sum(A.NetWeight) ');
|
|
|
|
|
|
sql.Add(',pf = CAST(A.C_Width AS DECIMAL(18,2))/100*sum(A.meter) ');
|
|
|
|
|
|
sql.Add(' FROM V_Tat_Cloth_IO A ');
|
|
|
|
|
|
sql.Add(' left JOIN Tat_Cloth_DR_Main B on A.IONo = B.DRMID ');
|
|
|
|
|
|
sql.Add(' where A.IOFlag = ''<27><><EFBFBD><EFBFBD>'' and A.IONo<>'''' and A.IONo is not null ');
|
|
|
|
|
|
sql.Add(WSql);
|
|
|
|
|
|
SQL.Add(' group by A.C_CODE ,A.C_Width,A.C_GramWeight,A.IONo,A.C_Name');
|
|
|
|
|
|
SQL.Add(' order by A.IONo');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-14 15:11:06 +08:00
|
|
|
|
|
|
|
|
|
|
// showmessage(sql.text);
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|
|
|
|
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
|
|
|
ADOQueryMain.EnableControls;
|
|
|
|
|
|
TV1.DataController.Filter.Clear;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.IsJYTimeClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.TBRafreshClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
CurrentPage := 1;
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.CDS_1BeforeOpen(DataSet: TDataSet);
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
lstCust.Clear;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.ConNoMChange(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if ADOQueryMain.Active then
|
|
|
|
|
|
begin
|
|
|
|
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.cxPageControl1Change(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
CurrentPage := 1;
|
|
|
|
|
|
SetStatus();
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.cxTabControl1Change(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.C_NameKeyPress(Sender: TObject; var Key: Char);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
if Key = #13 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.TBCloseClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
Close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.FormShow(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
ReadCxGrid(trim(self.Caption) + 'Tv1', Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|
|
|
|
|
CurrentPage := 1;
|
|
|
|
|
|
RecordsNumber := 500;
|
|
|
|
|
|
canshu1 := Trim(Self.fParameters1);
|
2025-12-09 17:30:02 +08:00
|
|
|
|
EndDate.DateTime := SGetServerDate(ADOQueryTemp);
|
|
|
|
|
|
BegDate.DateTime := EndDate.DateTime;
|
2025-11-14 15:11:06 +08:00
|
|
|
|
SetStatus();
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.TBExportClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if ADOQueryMain.IsEmpty then
|
|
|
|
|
|
exit;
|
|
|
|
|
|
TcxGridToExcel(Self.Caption, cxGrid1);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.orderNoKeyPress(Sender: TObject; var Key: Char);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Key = #13 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
CurrentPage := 1;
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.PM11Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
SelOKNo(CDS_1, false);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.Tv1DataControllerFilterBeforeChange(Sender: TcxDBDataFilterCriteria; ADataSet: TDataSet; const AFilterText: string);
|
|
|
|
|
|
begin
|
|
|
|
|
|
lstCust.Clear;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.Tv1TcxGridDBDataControllerTcxDataSummaryFooterSummaryItems6GetText(Sender: TcxDataSummaryItem; const AValue: Variant; AIsFooter: Boolean; var AText: string);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if lstCust <> nil then
|
|
|
|
|
|
AText := IntToStr(lstCust.Count);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.BTNPClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if CurrentPage < CDS_1.FieldByName('TotalCount').AsInteger / RecordsNumber then
|
|
|
|
|
|
CurrentPage := CurrentPage + 1;
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.BTLPClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if CurrentPage > 1 then
|
|
|
|
|
|
CurrentPage := CurrentPage - 1;
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.TCBNORChange(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
CurrentPage := 1;
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.JYTypeChange(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
CurrentPage := 1;
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.N1Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
SelOKNo(CDS_1, true);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.ToolButton2Click(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
WSql: string;
|
|
|
|
|
|
begin
|
|
|
|
|
|
if CDS_1.IsEmpty then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
if not CDS_1.Locate('SSel', True, []) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
WSql := '';
|
|
|
|
|
|
CDS_1.DisableControls;
|
|
|
|
|
|
with CDS_1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
First;
|
|
|
|
|
|
while not Eof do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if CDS_1.fieldbyname('SSel').AsBoolean then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if WSql <> '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
WSql := WSql + ',' + QuotedStr(Trim(CDS_1.fieldbyname('CIID').AsString));
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
WSql := QuotedStr(Trim(CDS_1.fieldbyname('CIID').AsString));
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
Next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
CDS_1.Locate('SSel', True, []);
|
|
|
|
|
|
CDS_1.EnableControls;
|
|
|
|
|
|
try
|
|
|
|
|
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|
|
|
|
|
with frmLabelPrint do
|
|
|
|
|
|
begin
|
|
|
|
|
|
FLMType := 'TradeClothStk';
|
|
|
|
|
|
FFiltration1 := WSql;
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmLabelPrint.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTatClothCKHZList.ToolButton4Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
WriteCxGrid(trim(self.Caption) + 'Tv1', Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|
|
|
|
|
|
|