299 lines
9.5 KiB
ObjectPascal
299 lines
9.5 KiB
ObjectPascal
unit U_TJCKDCView;
|
||
|
||
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
|
||
TfrmTJCKDCView = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
Label3: TLabel;
|
||
OrderNo: TEdit;
|
||
cxGrid4: TcxGrid;
|
||
Tv6: TcxGridDBBandedTableView;
|
||
cxGridDBBandedColumn1: TcxGridDBBandedColumn;
|
||
v6DutyPerson: TcxGridDBBandedColumn;
|
||
v6DutyFactoryName: TcxGridDBBandedColumn;
|
||
v6DutyReason: TcxGridDBBandedColumn;
|
||
v6Column4: TcxGridDBBandedColumn;
|
||
v6Column5: TcxGridDBBandedColumn;
|
||
v6Column6: TcxGridDBBandedColumn;
|
||
v6Column8: TcxGridDBBandedColumn;
|
||
v6Column9: TcxGridDBBandedColumn;
|
||
v6Column10: TcxGridDBBandedColumn;
|
||
v6Column11: TcxGridDBBandedColumn;
|
||
v6ToFactoryName: TcxGridDBBandedColumn;
|
||
v6Column7: TcxGridDBBandedColumn;
|
||
cxGridLevel3: TcxGridLevel;
|
||
v6Column15: TcxGridDBBandedColumn;
|
||
v6Column17: TcxGridDBBandedColumn;
|
||
v6Column18: TcxGridDBBandedColumn;
|
||
ClientDataSet6: TClientDataSet;
|
||
DataSource6: TDataSource;
|
||
ADOQuery1: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
Label1: TLabel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
v6Column20: TcxGridDBBandedColumn;
|
||
v6Column21: TcxGridDBBandedColumn;
|
||
ScrollBox3: TScrollBox;
|
||
v6Column1: TcxGridDBBandedColumn;
|
||
v6Column2: TcxGridDBBandedColumn;
|
||
cxGrid5: TcxGrid;
|
||
Tv5: TcxGridDBTableView;
|
||
cxGridDBColumn9: TcxGridDBColumn;
|
||
v5Column2: TcxGridDBColumn;
|
||
v5Column7: TcxGridDBColumn;
|
||
cxGridDBColumn8: TcxGridDBColumn;
|
||
v5Column3: TcxGridDBColumn;
|
||
v5Column1: TcxGridDBColumn;
|
||
v5Column9: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
Panel3: TPanel;
|
||
Label16: TLabel;
|
||
Label18: TLabel;
|
||
ConCode: TEdit;
|
||
Label19: TLabel;
|
||
ConName: TEdit;
|
||
v5Column8: TcxGridDBColumn;
|
||
DataSource5: TDataSource;
|
||
ClientDataSet5: TClientDataSet;
|
||
v6Column14: TcxGridDBBandedColumn;
|
||
v6Column19: TcxGridDBBandedColumn;
|
||
ADOQueryMain: TADOQuery;
|
||
Label21: TLabel;
|
||
ClotheType10: TComboBox;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
cxGridPopupMenu4: TcxGridPopupMenu;
|
||
v6Column12: TcxGridDBBandedColumn;
|
||
v6Column13: TcxGridDBBandedColumn;
|
||
v5Column4: TcxGridDBColumn;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure v6Column2PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure v6Column14PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure OrderNoChange(Sender: TObject);
|
||
procedure ConCodeChange(Sender: TObject);
|
||
procedure Tv6CellClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
private
|
||
{ Private declarations }
|
||
procedure InitGrid();
|
||
procedure InitGridKK();
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmTJCKDCView: TfrmTJCKDCView;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_RTFun, U_GYSList,U_ZDYHelp;
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmTJCKDCView.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmTJCKDCView:=nil;
|
||
end;
|
||
|
||
procedure TfrmTJCKDCView.FormClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmTJCKDCView.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
procedure TfrmTJCKDCView.InitGrid();
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select JM.OrderNo, A.*,B.PSName OrdPSName,C.ConNo,C.FactoryNoName,D.Price, ');
|
||
sql.Add(' JS.PRTHX,D.C_Code,D.C_CodeName,ClotheType10=A.ClotheType,');
|
||
sql.Add(' PRTColor=isnull(JS.PRTColorNo,'''')+'' ''+isnull(JS.PRTColorEng,'''')+'' ''+isnull(JS.PRTColor,''''), ');
|
||
sql.Add(' JSKCPS=A.RKPS-A.CKPS,');
|
||
sql.Add(' JSKCQty=A.RKQty-A.CKQty');
|
||
sql.Add(' from JYOrder_Main_MD A');
|
||
sql.Add(' inner join JYOrder_Main JM on A.OrdMainId=JM.MainId');
|
||
sql.Add(' left join JYOrder_Sub JS on A.OrdSubId=JS.SubId');
|
||
sql.Add(' inner join JYOrder_Process B on A.PSID=B.PSID');
|
||
sql.Add(' left join Contract_Main C on A.ConMainid=C.MainID');
|
||
sql.Add(' left join Contract_Sub D on A.ConSubid=D.SubID');
|
||
SQL.Add(' where isnull(A.CKName,'''')=''<27><><EFBFBD>ڲֿ<DAB2>'' and isnull(A.Status,'''')=''<27><>ȷ<EFBFBD><C8B7>'' ');
|
||
sql.Add(' and A.FillTime>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.Date))+'''');
|
||
sql.Add(' and A.FillTime<'''+Trim(FormatDateTime('yyyy-MM-dd',EndDate.Date+1))+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,ClientDataSet6);
|
||
SInitCDSData20(ADOQueryMain,ClientDataSet6);
|
||
end;
|
||
procedure TfrmTJCKDCView.InitGridKK();
|
||
var
|
||
fsj:string;
|
||
begin
|
||
|
||
|
||
end;
|
||
procedure TfrmTJCKDCView.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxBandedGrid('Tv61',Tv6,'<27><><EFBFBD>ڲֿ<DAB2>');
|
||
{ReadCxBandedGrid('Tv2',Tv2,'<27><><EFBFBD>ڲֿ<DAB2>');
|
||
ReadCxBandedGrid('Tv3',Tv3,'<27><><EFBFBD>ڲֿ<DAB2>');
|
||
ReadCxGrid('Tv5',Tv5,'<27><><EFBFBD>ڲֿ<DAB2>'); }
|
||
EndDate.Date:=SGetServerDate(ADOQuery1);
|
||
BegDate.Date:=EndDate.Date-60;
|
||
end;
|
||
|
||
procedure TfrmTJCKDCView.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxBandedGrid('Tv61',Tv6,'<27><><EFBFBD>ڲֿ<DAB2>');
|
||
close;
|
||
end;
|
||
|
||
procedure TfrmTJCKDCView.v6Column2PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmGYSList:=TfrmGYSList.Create(Application);
|
||
with frmGYSList do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.ClientDataSet6 do
|
||
begin
|
||
Edit;
|
||
FieldByName('DutyFactoryNo').Value:=Trim(frmGYSList.Order_Main.fieldbyname('ZKID').AsString) ;
|
||
FieldByName('DutyFactoryName').Value:=Trim(frmGYSList.Order_Main.fieldbyname('KHNameJC').AsString);
|
||
//Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmGYSList.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTJCKDCView.v6Column14PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmGYSList:=TfrmGYSList.Create(Application);
|
||
with frmGYSList do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.ClientDataSet6 do
|
||
begin
|
||
Edit;
|
||
FieldByName('ToFactoryNo').Value:=Trim(frmGYSList.Order_Main.fieldbyname('ZKID').AsString) ;
|
||
FieldByName('ToFactoryName').Value:=Trim(frmGYSList.Order_Main.fieldbyname('KHNameJC').AsString);
|
||
//Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmGYSList.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTJCKDCView.OrderNoKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key=#13 then
|
||
begin
|
||
if Trim(OrderNo.Text)='' then Exit;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select JM.OrderNo, A.*,B.PSName OrdPSName,C.ConNo,C.FactoryNoName,D.Price, ');
|
||
sql.Add(' JS.PRTHX,D.C_Code,D.C_CodeName,ClotheType10=A.ClotheType,');
|
||
sql.Add(' PRTColor=isnull(JS.PRTColorNo,'''')+'' ''+isnull(JS.PRTColorEng,'''')+'' ''+isnull(JS.PRTColor,''''), ');
|
||
sql.Add(' JSKCPS=A.RKPS-A.CKPS,');
|
||
sql.Add(' JSKCQty=A.RKQty-A.CKQty');
|
||
sql.Add(' from JYOrder_Main_MD A');
|
||
sql.Add(' inner join JYOrder_Main JM on A.OrdMainId=JM.MainId');
|
||
sql.Add(' left join JYOrder_Sub JS on A.OrdSubId=JS.SubId');
|
||
sql.Add(' inner join JYOrder_Process B on A.PSID=B.PSID');
|
||
sql.Add(' left join Contract_Main C on A.ConMainid=C.MainID');
|
||
sql.Add(' left join Contract_Sub D on A.ConSubid=D.SubID');
|
||
SQL.Add(' where isnull(A.CKName,'''')=''<27><><EFBFBD>ڲֿ<DAB2>'' and isnull(A.Status,'''')=''<27><>ȷ<EFBFBD><C8B7>'' ');
|
||
sql.Add(' and JM.OrderNo like '''+'%'+Trim(OrderNo.Text)+'%'+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,ClientDataSet6);
|
||
SInitCDSData20(ADOQueryMain,ClientDataSet6);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTJCKDCView.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active=False then Exit;
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS20(ADOQueryMain,ClientDataSet6);
|
||
SInitCDSData20(ADOQueryMain,ClientDataSet6);
|
||
end;
|
||
|
||
procedure TfrmTJCKDCView.OrderNoChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmTJCKDCView.ConCodeChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmTJCKDCView.Tv6CellClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,E.PSName,C.OrderNO,MPRTCode=C.MPRTCode+C.MPRTGY,D.PRTHX ');
|
||
sql.Add(',PRTColor=isnull(D.PRTColorNo,'''')+'' ''+isnull(D.PRTColor,'''')+'' ''+isnull(D.PRTColorEng,'''') ');
|
||
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(' where A.MDID='''+Trim(ClientDataSet6.fieldbyname('MDID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,ClientDataSet5);
|
||
SInitCDSData20(ADOQuery1,ClientDataSet5);
|
||
end;
|
||
|
||
end.
|