596 lines
18 KiB
ObjectPascal
596 lines
18 KiB
ObjectPascal
|
|
unit U_DyeOutputList;
|
|||
|
|
|
|||
|
|
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, MovePanel, cxButtonEdit, cxCalendar, RM_System, RM_Common,
|
|||
|
|
RM_Class, RM_GridReport, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
|||
|
|
dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu,
|
|||
|
|
U_BaseList, cxCheckBox, Vcl.Menus, dxSkinOffice2013White, dxSkinWXI,
|
|||
|
|
dxScrollbarAnnotations, Vcl.CheckLst, cxTextEdit;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmDyeOutputList = class(TfrmBaseList)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBFind: TToolButton;
|
|||
|
|
TBExport: TToolButton;
|
|||
|
|
TBPrint: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
pcid: TEdit;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
BegDate: TDateTimePicker;
|
|||
|
|
EndDate: TDateTimePicker;
|
|||
|
|
CDS_Main: TClientDataSet;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
v2Column1: TcxGridDBColumn;
|
|||
|
|
v1Column1: TcxGridDBColumn;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
orderNo: TEdit;
|
|||
|
|
MovePanel2: TMovePanel;
|
|||
|
|
Label10: TLabel;
|
|||
|
|
RMGridReport1: TRMGridReport;
|
|||
|
|
Label16: TLabel;
|
|||
|
|
v1Column2: TcxGridDBColumn;
|
|||
|
|
customerNoName: TEdit;
|
|||
|
|
Label13: TLabel;
|
|||
|
|
v1Column10: TcxGridDBColumn;
|
|||
|
|
ywy: TEdit;
|
|||
|
|
Label17: TLabel;
|
|||
|
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
|
Tv1Column8: TcxGridDBColumn;
|
|||
|
|
Tv1Column10: TcxGridDBColumn;
|
|||
|
|
Tv1Column11: TcxGridDBColumn;
|
|||
|
|
Tv1Column12: TcxGridDBColumn;
|
|||
|
|
C_Color: TEdit;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
C_ColorNo: TEdit;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
lbHx: TEdit;
|
|||
|
|
Label7: TLabel;
|
|||
|
|
TBdel: TToolButton;
|
|||
|
|
GlideName: TComboBox;
|
|||
|
|
Tv1Column15: TcxGridDBColumn;
|
|||
|
|
begtime: TDateTimePicker;
|
|||
|
|
endTime: TDateTimePicker;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
|
Edit1: TEdit;
|
|||
|
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
|
Tv1Column13: TcxGridDBColumn;
|
|||
|
|
Label11: TLabel;
|
|||
|
|
C_Name: TEdit;
|
|||
|
|
Label12: TLabel;
|
|||
|
|
C_StyleNo: TEdit;
|
|||
|
|
Tv1Column14: TcxGridDBColumn;
|
|||
|
|
Label14: TLabel;
|
|||
|
|
Worker: TEdit;
|
|||
|
|
PM_1: TPopupMenu;
|
|||
|
|
N1: TMenuItem;
|
|||
|
|
N2: TMenuItem;
|
|||
|
|
Tv1Column19: TcxGridDBColumn;
|
|||
|
|
Tv1Column20: TcxGridDBColumn;
|
|||
|
|
CheckListBox1: TCheckListBox;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
C_CLwrap: TEdit;
|
|||
|
|
Label15: TLabel;
|
|||
|
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
|
Tv1Column9: TcxGridDBColumn;
|
|||
|
|
Tv1Column16: TcxGridDBColumn;
|
|||
|
|
Label8: TLabel;
|
|||
|
|
C_Code: TEdit;
|
|||
|
|
Tv1Column17: TcxGridDBColumn;
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
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 TBFindClick(Sender: TObject);
|
|||
|
|
procedure pcidChange(Sender: TObject);
|
|||
|
|
procedure PRTColorChange(Sender: TObject);
|
|||
|
|
procedure TBdelClick(Sender: TObject);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure orderNoChange(Sender: TObject);
|
|||
|
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
|
procedure TBPrintClick(Sender: TObject);
|
|||
|
|
procedure N1Click(Sender: TObject);
|
|||
|
|
procedure N2Click(Sender: TObject);
|
|||
|
|
procedure CheckBox1Click(Sender: TObject);
|
|||
|
|
procedure CheckBox2Click(Sender: TObject);
|
|||
|
|
procedure Tv1Column25PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
FLeft, FTop: Integer;
|
|||
|
|
procedure InitGrid();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
fsyrName, canshu1: string;
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmDyeOutputList: TfrmDyeOutputList;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_ZDYHelp, U_LabelPrint;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
frmDyeOutputList := nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
Action := caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
|
|||
|
|
EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
|||
|
|
BegDate.DateTime := EndDate.DateTime - 30;
|
|||
|
|
fsyrName := trim(DdataBase);
|
|||
|
|
canshu1 := trim(DParameters1);
|
|||
|
|
SInitComBoxBySql(ADOQueryTemp, GlideName, false, 'select PSName as Name from Trade_Process');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.InitGrid();
|
|||
|
|
var
|
|||
|
|
Msql, mbegdate, menddate: string;
|
|||
|
|
begin
|
|||
|
|
Msql := '';
|
|||
|
|
if SGetFilters(Panel1, 1, 2) <> '' then
|
|||
|
|
Msql := Msql + ' and ' + SGetFilters(Panel1, 1, 2);
|
|||
|
|
mbegdate := FormatDateTime('yyyy-MM-dd', begdate.Date) + ' ' + FormatDateTime('HH:nn', begTime.Time);
|
|||
|
|
menddate := FormatDateTime('yyyy-MM-dd', enddate.Date) + ' ' + FormatDateTime('HH:nn', endTime.Time);
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
Filtered := False;
|
|||
|
|
// sql.Add('select A.*,B.* from Trade_Plan_Glide_OutPut A ');
|
|||
|
|
// sql.Add('select A.*,B.orderNo,B.CustName,B.Saleser,B.C_Name,B.C_Spec,C_ColorNo,B.C_Color , ');
|
|||
|
|
// sql.Add('select Filler=(select '' ''+cast(B.EEName as varchar(20)) from SY_Employee B where B.groupNO=(select groupNO from SY_Employee X where X.EEName=A.Filler ) for xml path('''')) ');
|
|||
|
|
// sql.Add('select * , DJStatus=case when PCQty=Qty then ');
|
|||
|
|
// sql.Add('case when GlideName=''<27><><EFBFBD><EFBFBD>'' then 1 else 0 end ');
|
|||
|
|
// sql.Add('else');
|
|||
|
|
// sql.Add('case when GlideName=''<27><><EFBFBD><EFBFBD>'' then 0 else 1 end ');
|
|||
|
|
sql.Add('select * ');
|
|||
|
|
sql.Add('from(');
|
|||
|
|
// sql.Add('select case when (select ISNULL(groupNO,'''') from SY_Employee B where B.EEName=A.Filler)='''' ');
|
|||
|
|
// sql.Add('then A.Filler else (select '' ''+cast(B.EEName as varchar(20)) from SY_Employee B where B.groupNO=(select groupNO from SY_Employee X where X.EEName=A.Filler ) for xml path('''')) end as Filler1,');
|
|||
|
|
sql.Add('select A.*,B.mainid,B.orderNo,B.CustName,B.Saleser,B.C_Name,C_ColorNo,B.C_Color,B.BuyConNo,B.PCQty,B.C_StyleNo,B.PCTime,B.C_CLwrap,crop');
|
|||
|
|
SQL.Add(',C_ECOLOR=(SELECT C_ECOLOR FROM Bs_Contract_Sub G WHERE G.consid=b.subid)');
|
|||
|
|
SQL.Add(',FNFKU=(SELECT FNFKU FROM Bs_Contract_Sub G WHERE G.consid=b.subid)');
|
|||
|
|
SQL.Add(',C_LSNO=(SELECT C_LSNO FROM Bs_Contract_Sub G WHERE G.consid=b.subid)');
|
|||
|
|
sql.Add(',conno=(select conno from Bs_Contract_Main s where s.conmid=b.mainid)');
|
|||
|
|
sql.Add('from Trade_Plan_Glide_OutPut A ');
|
|||
|
|
sql.Add('inner join Trade_Plan_Card B on A.PCID=B.PCID ');
|
|||
|
|
sql.add('where 1=1');
|
|||
|
|
|
|||
|
|
sql.add('and A.Valid=''Y'' ');
|
|||
|
|
sql.add('and A.GOTime>=''' + trim(mbegdate) + ''' ');
|
|||
|
|
sql.Add('and A.GOTime<''' + trim(menddate) + ''' ');
|
|||
|
|
|
|||
|
|
sql.Add('and (select top 1 Workshop from Trade_Process e where e.PSName=a.glidename)=''' + trim(dParameters1) + ''' ');
|
|||
|
|
|
|||
|
|
if trim(fParameters2) <> '' then
|
|||
|
|
begin
|
|||
|
|
sql.Add('and RTRIM(A.StaffName) in (select RTRIM(UserName) from sy_user where RTRIM(UType)=' + quotedstr(trim(fParameters2)) + ') ');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if pcid.text <> '' then
|
|||
|
|
begin
|
|||
|
|
sql.Add('and A.pcid =''' + trim(pcid.text) + ''' ');
|
|||
|
|
end;
|
|||
|
|
// sql.Add(Msql);
|
|||
|
|
sql.Add(')AA');
|
|||
|
|
// showmessage(sql.Text);
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQueryMain, CDS_Main);
|
|||
|
|
SInitCDSData(ADOQueryMain, CDS_Main);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
TBFind.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.N1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
SelOKNo(CDS_Main, true);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.N2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
SelOKNo(CDS_Main, False);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.orderNoChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
TBFind.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
MovePanel2.Visible := True;
|
|||
|
|
MovePanel2.Refresh;
|
|||
|
|
InitGrid();
|
|||
|
|
MovePanel2.Visible := False;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid(self.Caption + tv1.Name, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>1');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.ToolButton2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
if CDS_Main.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if trim(Edit1.text) = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><EFBFBD><DEB8><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if CDS_Main.FieldByName('SSel').AsBoolean = True then
|
|||
|
|
begin
|
|||
|
|
// with ADOQueryTemp do
|
|||
|
|
// begin
|
|||
|
|
// Close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// Filtered := False;
|
|||
|
|
// sql.Add('select SL=(select PCQty from Trade_Plan_Card where PCID=''' + Trim(CDS_Main.fieldbyname('PCID').AsString) + ''' )');
|
|||
|
|
//// showmessage(sql.Text);
|
|||
|
|
// Open;
|
|||
|
|
// end;
|
|||
|
|
//
|
|||
|
|
// if strtofloat(trim(Edit1.text)) > strtofloat(ADOQueryTemp.FieldByName('SL').AsString) then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('<27><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
// Exit;
|
|||
|
|
// end;
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update Trade_Plan_Glide_OutPut Set Qty=''' + trim(Edit1.Text) + ''' ');
|
|||
|
|
sql.Add('where GOID=''' + Trim(CDS_Main.fieldbyname('GOID').AsString) + '''');
|
|||
|
|
|
|||
|
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
|
sql.Add(',getdate() ');
|
|||
|
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>IJ<DEB8><C4B2><EFBFBD>')));
|
|||
|
|
sql.Add(',' + quotedstr(trim('GOID<49><44>' + trim(CDS_Main.fieldbyname('GOID').AsString) + trim(CDS_Main.fieldbyname('GlideName').AsString) + trim((Edit1.Text)))));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
|
sql.Add(')');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Edit1.text := '';
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.Tv1Column25PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mvalue, FFieldName: string;
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
|
with CDS_Main do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName(FFieldName).Value := Trim(mvalue);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update Trade_Plan_Glide_OutPut ');
|
|||
|
|
sql.Add('Set ' + FFieldName + '=''' + Trim(mvalue) + '''');
|
|||
|
|
sql.Add('where GOID=''' + Trim(CDS_Main.fieldbyname('GOID').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
if AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('DJstatus').Index] = '1' then
|
|||
|
|
ACanvas.Brush.Color := clRed;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.CheckBox1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
BegDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
|||
|
|
EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
|||
|
|
// CheckBox2.Checked := False;
|
|||
|
|
InitGrid();
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.CheckBox2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
// if CheckBox2.Checked then
|
|||
|
|
// begin
|
|||
|
|
// BegDate.DateTime := SGetServerDateTime(ADOQueryTemp) - 1;
|
|||
|
|
// EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
|||
|
|
// CheckBox1.Checked := False;
|
|||
|
|
// InitGrid();
|
|||
|
|
// end
|
|||
|
|
// else
|
|||
|
|
// begin
|
|||
|
|
// CheckBox1.Checked := true;
|
|||
|
|
// InitGrid();
|
|||
|
|
// end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.ConNoMChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active then
|
|||
|
|
begin
|
|||
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
ReadCxGrid(self.Caption + tv1.Name, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>1');
|
|||
|
|
canshu1 := self.fParameters1;
|
|||
|
|
BegDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
|||
|
|
EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
|||
|
|
initgrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.TBExportClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
// SelExportData(tv1,ADOQueryMain,self.Caption);
|
|||
|
|
TcxGridToExcel(self.Caption, cxGrid2);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.TBFindClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active then
|
|||
|
|
begin
|
|||
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
|
SCreateCDS(ADOQueryMain, CDS_Main);
|
|||
|
|
SInitCDSData(ADOQueryMain, CDS_Main);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.TBPrintClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
WSql: string;
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
WSql := '';
|
|||
|
|
if CDS_Main.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with CDS_Main do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if Fieldbyname('Ssel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
if WSql <> '' then
|
|||
|
|
begin
|
|||
|
|
WSql := WSql + ',' + quotedstr(Trim(CDS_Main.fieldbyname('GOID').AsString));
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
WSql := quotedstr(Trim(CDS_Main.fieldbyname('GOID').AsString));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
// showmessage(WSql);
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
|
with frmLabelPrint do
|
|||
|
|
begin
|
|||
|
|
FLMType := 'ClCardPrint';
|
|||
|
|
FFiltration1 := WSql;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
// with ADOQueryCmd do
|
|||
|
|
// begin
|
|||
|
|
// close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('update Trade_Plan_Card SET status=''9'' ,chker=''' + trim(DName) + ''',Chktime=getdate() ');
|
|||
|
|
// sql.Add(' where EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + quotedstr(WSql) + ','','') X where X.RTValue=Trade_Plan_Card.PCID ) ');
|
|||
|
|
// execsql;
|
|||
|
|
// end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmLabelPrint.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.pcidChange(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mbegdate, menddate: string;
|
|||
|
|
begin
|
|||
|
|
// TBFind.Click;
|
|||
|
|
mbegdate := FormatDateTime('yyyy-MM-dd', begdate.Date) + ' ' + FormatDateTime('HH:nn', begTime.Time);
|
|||
|
|
menddate := FormatDateTime('yyyy-MM-dd', enddate.Date) + ' ' + FormatDateTime('HH:nn', endTime.Time);
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
Filtered := False;
|
|||
|
|
// sql.Add('select A.*,B.* from Trade_Plan_Glide_OutPut A ');
|
|||
|
|
// sql.Add('select A.*,B.orderNo,B.CustName,B.Saleser,B.C_Name,B.C_Spec,C_ColorNo,B.C_Color from Trade_Plan_Glide_OutPut A ');
|
|||
|
|
sql.Add('select A.*,B.* from Trade_Plan_Glide_OutPut A ');
|
|||
|
|
sql.Add('inner join Trade_Plan_Card B on A.PCID=B.PCID ');
|
|||
|
|
sql.add('where A.GOTime>=''' + trim(mbegdate) + ''' ');
|
|||
|
|
sql.Add('and A.GOTime<''' + trim(menddate) + ''' ');
|
|||
|
|
if pcid.text <> '' then
|
|||
|
|
begin
|
|||
|
|
// sql.Add('and A.pcid =''' + trim(pcid.text) + ''' ');
|
|||
|
|
sql.Add('and A.pcid like ''%' + trim(pcid.text) + '%'' ');
|
|||
|
|
end;
|
|||
|
|
// sql.Add(Msql);
|
|||
|
|
// showmessage(sql.Text);
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQueryMain, CDS_Main);
|
|||
|
|
SInitCDSData(ADOQueryMain, CDS_Main);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.PRTColorChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TBFind.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeOutputList.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 CDS_Main do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if Fieldbyname('Ssel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete Trade_Plan_Glide_OutPut where GOID=''' + Trim(CDS_Main.fieldbyname('GOID').AsString) + '''');
|
|||
|
|
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('insert into Trade_Need_Up(UType,UDataId) values(''<27><>̨ˢ<CCA8><CBA2>'',' + quotedstr(Trim(CDS_Main.fieldbyname('GOID').AsString)) + ') ');
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
|
|||
|
|
// CDS_Main.Delete;
|
|||
|
|
except
|
|||
|
|
application.MessageBox('ɾ<><C9BE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
except
|
|||
|
|
CDS_Main.EnableControls;
|
|||
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
// try
|
|||
|
|
// with ADOQueryCmd do
|
|||
|
|
// begin
|
|||
|
|
// Close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('delete Trade_Plan_Glide_OutPut where GOID=''' + Trim(CDS_Main.fieldbyname('GOID').AsString) + '''');
|
|||
|
|
//
|
|||
|
|
// ExecSQL;
|
|||
|
|
// end;
|
|||
|
|
//////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
|
|||
|
|
// with ADOQueryCmd do
|
|||
|
|
// begin
|
|||
|
|
// Close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('insert into Trade_Need_Up(UType,UDataId) values(''<27><>̨ˢ<CCA8><CBA2>'',' + quotedstr(Trim(CDS_Main.fieldbyname('GOID').AsString)) + ') ');
|
|||
|
|
// execsql;
|
|||
|
|
// end;
|
|||
|
|
//////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
|
|||
|
|
// CDS_Main.Delete;
|
|||
|
|
// except
|
|||
|
|
// application.MessageBox('ɾ<><C9BE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
// end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|