210 lines
5.3 KiB
ObjectPascal
210 lines
5.3 KiB
ObjectPascal
unit U_PbSelRK;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||
cxDataStorage, cxEdit, DB, cxDBData, StdCtrls, ADODB, DBClient, ComCtrls,
|
||
ExtCtrls, cxGridLevel, cxGridCustomTableView, cxGridTableView,
|
||
cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, cxCheckBox;
|
||
|
||
type
|
||
TfrmPbSelRK = class(TForm)
|
||
Panel1: TPanel;
|
||
Label2: TLabel;
|
||
conNo: TEdit;
|
||
Label3: TLabel;
|
||
PRTColor: TEdit;
|
||
CDS_OrderSel: TClientDataSet;
|
||
DataSource1: TDataSource;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
Button1: TButton;
|
||
Button2: TButton;
|
||
Button3: TButton;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
Label8: TLabel;
|
||
CustomerNoName: TEdit;
|
||
cxGrid1: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
v2Column3: TcxGridDBColumn;
|
||
v1OrderNo: TcxGridDBColumn;
|
||
v2Column2: TcxGridDBColumn;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column14: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
v1PRTMF: TcxGridDBColumn;
|
||
v1PRTKZ: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
cxStyleRepository1: TcxStyleRepository;
|
||
cxStyle1: TcxStyle;
|
||
cxStyleRepository2: TcxStyleRepository;
|
||
cxStyle2: TcxStyle;
|
||
cxStyleRepository3: TcxStyleRepository;
|
||
cxStyle3: TcxStyle;
|
||
CheckBox1: TCheckBox;
|
||
v2Column5: TcxGridDBColumn;
|
||
Aorddefstr4: TEdit;
|
||
Label1: TLabel;
|
||
C_CodeName: TEdit;
|
||
Label4: TLabel;
|
||
C_Color: TEdit;
|
||
Label5: TLabel;
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure Button2Click(Sender: TObject);
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure Button3Click(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure conNoChange(Sender: TObject);
|
||
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
procedure CheckBox1Click(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
procedure InitGrid();
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmPbSelRK: TfrmPbSelRK;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_Fun ;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmPbSelRK.FormClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmPbSelRK.Button2Click(Sender: TObject);
|
||
var
|
||
KHName:String;
|
||
begin
|
||
if CDS_OrderSel.Locate('SSel',True,[])=False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
CDS_OrderSel.DisableControls;
|
||
KHName:='';
|
||
with CDS_OrderSel do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if FieldByName('SSel').AsBoolean=True then
|
||
begin
|
||
if Trim(KHName)='' then
|
||
begin
|
||
KHName:=Trim(fieldbyname('Aorddefstr4').AsString);
|
||
end else
|
||
begin
|
||
if Trim(fieldbyname('Aorddefstr4').AsString)<>KHName then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
CDS_OrderSel.EnableControls;
|
||
ModalResult:=1;
|
||
end;
|
||
|
||
procedure TfrmPbSelRK.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmPbSelRK:=nil;
|
||
end;
|
||
|
||
procedure TfrmPbSelRK.Button3Click(Sender: TObject);
|
||
begin
|
||
ModalResult:=-1;
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>',Tv2,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmPbSelRK.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>',Tv2,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmPbSelRK.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select APID,ConNo,Aorddefstr1,Aorddefstr4,MainId,SubId,AOrdQty1,AOrdQty2,C_CodeName,C_Color,count(MJlen) as ZPPS,sum(MJLen) as ZPQty');
|
||
sql.Add(' from (');
|
||
sql.Add(' select A.APID,A.ConNo,A.Aorddefstr1,A.Aorddefstr4,A.MainId,A.SubId,A.AOrdQty1,A.AOrdQty2,B.C_CodeName,B.C_Color,B.Mjlen,B.MjID ');
|
||
sql.Add(' from JYOrder_Sub_AnPai A ');
|
||
sql.Add(' inner join WFB_MJJY B on B.APID=A.APID and B.MJlen<>0 and B.Mjstr2=''δ<><CEB4><EFBFBD><EFBFBD> '' ');
|
||
sql.Add(' ) AA group by APID,ConNo,Aorddefstr1,Aorddefstr4,MainId,SubId,AOrdQty1,AOrdQty2,C_CodeName,C_Color');
|
||
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_OrderSel);
|
||
SInitCDSData20(ADOQueryMain,CDS_OrderSel);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPbSelRK.Button1Click(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmPbSelRK.conNoChange(Sender: TObject);
|
||
begin
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS20(ADOQueryMain,CDS_OrderSel);
|
||
SInitCDSData20(ADOQueryMain,CDS_OrderSel);
|
||
end;
|
||
|
||
procedure TfrmPbSelRK.Tv2CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
ModalResult:=1;
|
||
end;
|
||
|
||
procedure TfrmPbSelRK.CheckBox1Click(Sender: TObject);
|
||
begin
|
||
IF CDS_OrderSel.IsEmpty then exit;
|
||
with CDS_OrderSel do
|
||
begin
|
||
DisableControls;
|
||
first;
|
||
while not eof do
|
||
begin
|
||
edit;
|
||
fieldbyname('ssel').Value:=CheckBox1.Checked;
|
||
post;
|
||
next;
|
||
end;
|
||
First;
|
||
EnableControls;
|
||
end;
|
||
|
||
end;
|
||
|
||
end.
|