D7wmguihua/坯布码单待检(PBMDDJ.dll)/U_TJCKOutView.pas
DESKTOP-E401PHE\Administrator b4b5840f18 1
2025-01-18 16:22:10 +08:00

215 lines
6.9 KiB
ObjectPascal
Raw Blame History

unit U_TJCKOutView;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, cxButtonEdit, cxCalendar,
cxDropDownEdit, cxGridLevel, cxGridCustomTableView, cxGridTableView,
cxGridBandedTableView, cxGridDBBandedTableView, cxClasses, cxControls,
cxGridCustomView, cxGrid, StdCtrls, ExtCtrls, ComCtrls, ToolWin, DBClient,
ADODB, cxCheckBox, cxPC, BtnEdit, cxGridDBTableView,
cxGridCustomPopupMenu, cxGridPopupMenu;
type
TfrmTJCKOutView = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBFind: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
Label3: TLabel;
TQOrderNo: TEdit;
ADOQuery1: TADOQuery;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
Label1: TLabel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
Label18: TLabel;
TQMPRTCode: TEdit;
Label19: TLabel;
TQPRTColor: TEdit;
DataSource5: TDataSource;
ClientDataSet5: TClientDataSet;
ADOQueryMain: TADOQuery;
Label21: TLabel;
MDType: TComboBox;
cxGridPopupMenu4: TcxGridPopupMenu;
cxGrid5: TcxGrid;
Tv5: TcxGridDBTableView;
cxGridDBColumn8: TcxGridDBColumn;
cxGridDBColumn9: TcxGridDBColumn;
v5Column8: TcxGridDBColumn;
v5Column7: TcxGridDBColumn;
v5Column3: TcxGridDBColumn;
v5Column4: TcxGridDBColumn;
v5Column1: TcxGridDBColumn;
v5Column9: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
v5Column5: TcxGridDBColumn;
v5Column6: TcxGridDBColumn;
v5Column10: TcxGridDBColumn;
v5Column11: TcxGridDBColumn;
v5Column12: TcxGridDBColumn;
v5Column2: TcxGridDBColumn;
Label2: TLabel;
THOrderNo: TEdit;
Label4: TLabel;
THMPRTCode: TEdit;
Label5: TLabel;
THPRTColor: TEdit;
Label6: TLabel;
Label7: TLabel;
TQPRTHX: TEdit;
TQPSName: TEdit;
Label8: TLabel;
THPRTHX: TEdit;
Label9: TLabel;
THPSName: TEdit;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBRafreshClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure TQOrderNoKeyPress(Sender: TObject; var Key: Char);
procedure TBFindClick(Sender: TObject);
procedure TQOrderNoChange(Sender: TObject);
procedure THOrderNoKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
procedure InitGrid();
procedure InitGridStr(fsj:String);
public
{ Public declarations }
end;
var
frmTJCKOutView: TfrmTJCKOutView;
implementation
uses
U_DataLink,U_RTFun,U_ZDYHelp;
{$R *.dfm}
procedure TfrmTJCKOutView.FormDestroy(Sender: TObject);
begin
frmTJCKOutView:=nil;
end;
procedure TfrmTJCKOutView.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmTJCKOutView.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmTJCKOutView.InitGrid();
begin
with ADOQueryMain do
begin
Close;
sql.Clear;
sql.Add('select A.*,THPSName=E.PSName,THOrderNo=C.OrderNO,THMPRTCode=C.MPRTCode,THPRTHX=D.PRTHX ');
sql.Add(',THPRTColor=isnull(D.PRTColorNo,'''')+'' ''+isnull(D.PRTColor,'''')+'' ''+isnull(D.PRTColorEng,'''') ');
sql.Add(',TQPSName=EE.PSName,TQOrderNo=CC.OrderNO,TQMPRTCode=CC.MPRTCode+CC.MPRTGY,TQPRTHX=DD.PRTHX ');
sql.Add(',TQPRTColor=isnull(DD.PRTColorNo,'''')+'' ''+isnull(DD.PRTColor,'''')+'' ''+isnull(DD.PRTColorEng,'''') ');
sql.Add(',AA.MDType');
sql.Add(' from JYOrder_Main_MD_Out A ');
sql.Add(' left join JYOrder_PCS_Sub B on A.PFID=B.PFID');
sql.Add(' left join JYOrder_Process E on B.PSID=E.PSID');
sql.Add(' left join JYOrder_Main C on B.Mainid=C.Mainid');
sql.Add(' left join JYOrder_Sub D on B.Subid=D.SubId');
sql.Add(' inner join JYOrder_Main_MD AA on A.MDID=AA.MDID');
sql.Add(' inner join JYOrder_PCS_Sub BB on AA.PFID=BB.PFID');
sql.Add(' left join JYOrder_Process EE on BB.PSID=EE.PSID');
sql.Add(' left join JYOrder_Main CC on BB.Mainid=CC.Mainid');
sql.Add(' left join JYOrder_Sub DD on BB.Subid=DD.SubId');
sql.Add(' where A.FillTime>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.Date))+'''');
sql.Add(' and A.FillTime<'''+Trim(FormatDateTime('yyyy-MM-dd',EndDate.Date))+'''');
Open;
end;
SCreateCDS20(ADOQueryMain,ClientDataSet5);
SInitCDSData20(ADOQueryMain,ClientDataSet5);
end;
procedure TfrmTJCKOutView.InitGridStr(fsj:String);
begin
with ADOQueryMain do
begin
Close;
sql.Clear;
sql.Add('select A.*,THPSName=E.PSName,THOrderNo=C.OrderNO,THMPRTCode=C.MPRTCode+C.MPRTGY,THPRTHX=D.PRTHX ');
sql.Add(',THPRTColor=isnull(D.PRTColorNo,'''')+'' ''+isnull(D.PRTColor,'''')+'' ''+isnull(D.PRTColorEng,'''') ');
sql.Add(',TQPSName=EE.PSName,TQOrderNo=CC.OrderNO,TQMPRTCode=CC.MPRTCode+CC.MPRTGY,TQPRTHX=DD.PRTHX ');
sql.Add(',TQPRTColor=isnull(DD.PRTColorNo,'''')+'' ''+isnull(DD.PRTColor,'''')+'' ''+isnull(DD.PRTColorEng,'''') ');
sql.Add(',AA.MDType');
sql.Add(' from JYOrder_Main_MD_Out A ');
sql.Add(' left join JYOrder_PCS_Sub B on A.PFID=B.PFID');
sql.Add(' left join JYOrder_Process E on B.PSID=E.PSID');
sql.Add(' left join JYOrder_Main C on B.Mainid=C.Mainid');
sql.Add(' left join JYOrder_Sub D on B.Subid=D.SubId');
sql.Add(' inner join JYOrder_Main_MD AA on A.MDID=AA.MDID');
sql.Add(' inner join JYOrder_PCS_Sub BB on AA.PFID=BB.PFID');
sql.Add(' left join JYOrder_Process EE on BB.PSID=EE.PSID');
sql.Add(' left join JYOrder_Main CC on BB.Mainid=CC.Mainid');
sql.Add(' left join JYOrder_Sub DD on BB.Subid=DD.SubId');
sql.Add(' where 1=1');
sql.Add(fsj);
Open;
end;
SCreateCDS20(ADOQueryMain,ClientDataSet5);
SInitCDSData20(ADOQueryMain,ClientDataSet5);
end;
procedure TfrmTJCKOutView.FormShow(Sender: TObject);
begin
ReadCxGrid('Tv5',Tv5,'<27><><EFBFBD>ڲֿ<DAB2><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼');
EndDate.Date:=SGetServerDate(ADOQuery1);
BegDate.Date:=EndDate.Date-30;
end;
procedure TfrmTJCKOutView.TBCloseClick(Sender: TObject);
begin
WriteCxGrid('Tv5',Tv5,'<27><><EFBFBD>ڲֿ<DAB2><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼');
close;
end;
procedure TfrmTJCKOutView.TQOrderNoKeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
begin
if Trim(TQOrderNo.Text)='' then Exit;
InitGridStr(' and CC.OrderNo like '''+'%'+Trim(TQOrderNo.Text)+'%'+'''');
end;
end;
procedure TfrmTJCKOutView.TBFindClick(Sender: TObject);
begin
if ADOQueryMain.Active=False then Exit;
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
SCreateCDS20(ADOQueryMain,ClientDataSet5);
SInitCDSData20(ADOQueryMain,ClientDataSet5);
end;
procedure TfrmTJCKOutView.TQOrderNoChange(Sender: TObject);
begin
TBFind.Click;
end;
procedure TfrmTJCKOutView.THOrderNoKeyPress(Sender: TObject;
var Key: Char);
begin
if Key=#13 then
begin
if Trim(THOrderNo.Text)='' then Exit;
InitGridStr(' and C.OrderNo like '''+'%'+Trim(THOrderNo.Text)+'%'+'''');
end;
end;
end.