757 lines
19 KiB
ObjectPascal
757 lines
19 KiB
ObjectPascal
|
unit U_TradeRRList;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
|||
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
|||
|
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls,
|
|||
|
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|||
|
cxGrid, DBClient, cxCheckBox, cxCalendar, cxSplitter, RM_Dataset, RM_System,
|
|||
|
RM_Common, RM_Class, RM_GridReport, RM_e_Xls, Menus, cxPC, cxButtonEdit,
|
|||
|
cxDropDownEdit, cxTextEdit, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
|||
|
dxBarBuiltInMenu, dxSkinsCore, dxSkinsDefaultPainters, U_BaseList,
|
|||
|
dxDateRanges;
|
|||
|
|
|||
|
type
|
|||
|
TfrmTradeRRList = class(TfrmBaseList)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBEdit: TToolButton;
|
|||
|
TBDel: TToolButton;
|
|||
|
TBPrint: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
TBExport: TToolButton;
|
|||
|
v1OrdDate: TcxGridDBColumn;
|
|||
|
Order_Main: TClientDataSet;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
Panel1: TPanel;
|
|||
|
Label4: TLabel;
|
|||
|
Label8: TLabel;
|
|||
|
Label12: TLabel;
|
|||
|
Label13: TLabel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
ToCoName: TEdit;
|
|||
|
MPRTCodeName: TEdit;
|
|||
|
MPRTKZ: TEdit;
|
|||
|
MPRTMF: TEdit;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
tchk: TToolButton;
|
|||
|
Tnochk: TToolButton;
|
|||
|
cxSplitter1: TcxSplitter;
|
|||
|
DS_2: TDataSource;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
Label2: TLabel;
|
|||
|
ClientDataSet2: TClientDataSet;
|
|||
|
GPM_2: TcxGridPopupMenu;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
v1Column17: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
v1Column27: TcxGridDBColumn;
|
|||
|
btnWC: TToolButton;
|
|||
|
btnWCCX: TToolButton;
|
|||
|
CheckBox1: TCheckBox;
|
|||
|
ToolButton6: TToolButton;
|
|||
|
Label1: TLabel;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
TV2: TcxGridDBTableView;
|
|||
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
cxGridDBColumn2: TcxGridDBColumn;
|
|||
|
cxGridDBColumn3: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
cxGridDBColumn4: TcxGridDBColumn;
|
|||
|
cxGridDBColumn5: TcxGridDBColumn;
|
|||
|
cxGridDBColumn6: TcxGridDBColumn;
|
|||
|
cxGridDBColumn7: TcxGridDBColumn;
|
|||
|
cv1Column3: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
TV2Column1: TcxGridDBColumn;
|
|||
|
TV2Column2: TcxGridDBColumn;
|
|||
|
TV2Column3: TcxGridDBColumn;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
//RMllPDFExport1: TRMllPDFExport;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure TBFindClick(Sender: TObject);
|
|||
|
procedure TBEditClick(Sender: TObject);
|
|||
|
procedure TBDelClick(Sender: TObject);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure TBPrintClick(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure TBAddClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure CheckBox1Click(Sender: TObject);
|
|||
|
procedure CheckBox2Click(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToCoNameChange(Sender: TObject);
|
|||
|
procedure tchkClick(Sender: TObject);
|
|||
|
procedure TnochkClick(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure btnWCClick(Sender: TObject);
|
|||
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
procedure btnWCCXClick(Sender: TObject);
|
|||
|
procedure v1Column7PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure Tv1Column9PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
private
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitSubGrid();
|
|||
|
procedure SetStatus();
|
|||
|
function DelData(): Boolean;
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
FFInt: Integer;
|
|||
|
canshu1, canshu2: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
//var
|
|||
|
//frmContractListNX: TfrmContractListNX;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_TradeRRInPut, U_RTFun, U_ZDYHelp, U_LabelPrint;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmTradeRRList.SetStatus();
|
|||
|
begin
|
|||
|
tchk.Enabled := False;
|
|||
|
Tnochk.Enabled := False;
|
|||
|
btnWC.Enabled := False;
|
|||
|
btnWCCX.Enabled := False;
|
|||
|
|
|||
|
if canshu1 = '¼<><C2BC>' then
|
|||
|
begin
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
tchk.Enabled := true;
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
Tnochk.Enabled := true;
|
|||
|
btnWC.Enabled := true;
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
btnWCCX.Enabled := true;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end
|
|||
|
else if canshu1 = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
tchk.Enabled := true;
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
Tnochk.Enabled := true;
|
|||
|
btnWC.Enabled := true;
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
btnWCCX.Enabled := true;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
//frmFHSQList:=nil;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
Sql.Add(' select A.* ');
|
|||
|
sql.Add(' from Trade_Cloth_RR_Main A where 1=1');
|
|||
|
if CheckBox1.Checked then
|
|||
|
begin
|
|||
|
sql.Add(' and Filltime>=''' + FormatDateTime('yyyy-MM-dd', begdate.DateTime) + ''' ');
|
|||
|
sql.Add(' and Filltime<''' + FormatDateTime('yyyy-MM-dd', Enddate.DateTime + 1) + ''' ');
|
|||
|
end;
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
SQL.Add(' and isnull(A.status,''0'')=''0'' ');
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
SQL.Add(' and isnull(A.status,''0'')=''9'' ');
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
SQL.Add(' and isnull(A.status,''0'')=''10'' ');
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Trim(canshu1) <> '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(A.Filler,'''')=''' + Trim(DName) + '''');
|
|||
|
end;
|
|||
|
sql.Add(' order by Filltime desc ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, Order_Main);
|
|||
|
SInitCDSData(ADOQueryMain, Order_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
TV1.DataController.Filter.Clear;
|
|||
|
TV2.DataController.Filter.Clear;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.TBFindClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, Order_Main);
|
|||
|
SInitCDSData(ADOQueryMain, Order_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.TBEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
// if cxTabControl1.TabIndex <> 0 then
|
|||
|
// Exit;
|
|||
|
if Trim(canshu1) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select FILLER from Trade_Cloth_RR_Main A ');
|
|||
|
SQL.Add('where RRMID=''' + Trim(Order_Main.fieldbyname('RRMID').AsString) + ''' ');
|
|||
|
SQL.Add('and filler in ( select username from SY_User where UType=(select UType from SY_User where UserName=' + quotedstr(Trim(dname)));
|
|||
|
SQL.Add('))');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryTemp.ISEMPTY = True then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
// if Trim(Order_Main.fieldbyname('Filler').AsString) <> Trim(DName) then
|
|||
|
// begin
|
|||
|
// Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from Trade_Cloth_RR_Main');
|
|||
|
sql.Add('where RRMID=' + quotedstr(trim(Order_Main.fieldbyname('RRMID').AsString)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
// if Trim(ADOQueryTemp.fieldbyname('YSID').AsString) <> '' then
|
|||
|
// begin
|
|||
|
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>˿<CBBF><EEB2BB><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
try
|
|||
|
frmTradeRRInPut := TfrmTradeRRInPut.Create(Application);
|
|||
|
with frmTradeRRInPut do
|
|||
|
begin
|
|||
|
PState := 1;
|
|||
|
FRRMID := Trim(Self.Order_Main.fieldbyname('RRMID').AsString);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmTradeRRInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.TBDelClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
if cxTabControl1.TabIndex <> 0 then
|
|||
|
Exit;
|
|||
|
if canshu1 <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
begin
|
|||
|
if Trim(Order_Main.fieldbyname('Filler').AsString) <> Trim(DName) then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
if DelData() then
|
|||
|
begin
|
|||
|
initgrid();
|
|||
|
InitSubGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmTradeRRList.DelData(): Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
Result := false;
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from Trade_Cloth_IO where IOFlag=''<27><><EFBFBD><EFBFBD>''');
|
|||
|
sql.add(' and IONo=''' + Trim(Order_Main.fieldbyname('RRMID').AsString) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = False then
|
|||
|
begin
|
|||
|
Order_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27>ѷ<EFBFBD><D1B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete Trade_Cloth_RR_Sub where RRMID=''' + Trim(Order_Main.fieldbyname('RRMID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete Trade_Cloth_RR_Main where RRMID=''' + Trim(Order_Main.fieldbyname('RRMID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
order_main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Result := False;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
Exit;
|
|||
|
// SelExportData(Tv1, ADOQueryMain, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.TBPrintClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
try
|
|||
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
with frmLabelPrint do
|
|||
|
begin
|
|||
|
FLMType := 'TradeClothDR1';
|
|||
|
FFiltration1 := Trim(self.Order_Main.fieldbyname('RRMID').AsString);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmLabelPrint.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.TBAddClick(Sender: TObject);
|
|||
|
var
|
|||
|
maxno: string;
|
|||
|
begin
|
|||
|
try
|
|||
|
frmTradeRRInPut := TfrmTradeRRInPut.Create(Application);
|
|||
|
with frmTradeRRInPut do
|
|||
|
begin
|
|||
|
PState := 0;
|
|||
|
FRRMID := '';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmTradeRRInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
canshu1 := self.fParameters1;
|
|||
|
ReadCxGrid(trim(self.Caption) + 'Tv1', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
ReadCxGrid(trim(self.Caption) + 'Tv2', Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
|||
|
EndDate.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
BegDate.DateTime := EndDate.DateTime - 60;
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.CheckBox1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.CheckBox2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmTradeRRInPut := TfrmTradeRRInPut.Create(Application);
|
|||
|
with frmTradeRRInPut do
|
|||
|
begin
|
|||
|
PState := 1;
|
|||
|
FRRMID := Trim(Self.Order_Main.fieldbyname('RRMID').AsString);
|
|||
|
ToolBar2.Visible := False;
|
|||
|
TBSave.Visible := False;
|
|||
|
ScrollBox1.Enabled := False;
|
|||
|
Tv1.OptionsSelection.CellSelect := False;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmTradeRRInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.ToCoNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS(ADOQueryMain, Order_Main);
|
|||
|
SInitCDSData(ADOQueryMain, Order_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.tchkClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
if cxTabControl1.TabIndex <> 0 then
|
|||
|
exit;
|
|||
|
try
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Trade_Cloth_RR_Main SET Chker=''' + Trim(DName) + ''',ChkTime=getdate(),Status=''9'' ');
|
|||
|
sql.Add('where RRMID=' + quotedstr(trim(Order_Main.fieldbyname('RRMID').AsString)));
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
InitGrid();
|
|||
|
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.InitSubGrid();
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.* ');
|
|||
|
sql.Add('from Trade_Cloth_RR_Sub A where A.RRMID=''' + Trim(Order_Main.fieldbyname('RRMID').AsString) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryTemp, ClientDataSet2);
|
|||
|
SInitCDSData(ADOQueryTemp, ClientDataSet2);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.TnochkClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
if cxTabControl1.TabIndex <> 1 then
|
|||
|
exit;
|
|||
|
try
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Trade_Cloth_RR_Main SET Chker=Null,ChkTime=Null,status=''0'' ');
|
|||
|
sql.Add('where RRMID=' + quotedstr(trim(Order_Main.fieldbyname('RRMID').AsString)));
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
InitGrid();
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
SetStatus();
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.btnWCCXClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
try
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
// with ADOQueryTemp do
|
|||
|
// begin
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('exec P_CW_Judge_All @DataID=' + quotedstr(trim(Order_Main.fieldbyname('RRMID').AsString)));
|
|||
|
// Open;
|
|||
|
// end;
|
|||
|
// if ADOQueryTemp.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
// begin
|
|||
|
// Application.MessageBox(PChar(ADOQueryTemp.fieldbyname('ShowMsg').AsString), '<27><>ʾ', 0);
|
|||
|
// exit;
|
|||
|
// end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Trade_Cloth_RR_Main SET Comper=null,CompTime=null, status=''9'' ');
|
|||
|
sql.Add('where RRMID=' + quotedstr(trim(Order_Main.fieldbyname('RRMID').AsString)));
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
InitGrid();
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.ToolButton6Click(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(trim(self.Caption) + 'Tv1', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
WriteCxGrid(trim(self.Caption) + 'Tv2', Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.btnWCClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if Order_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
try
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Trade_Cloth_RR_Main SET Comper=''' + Trim(DName) + ''',CompTime=getdate(), status=''10'' ');
|
|||
|
sql.Add('where RRMID=' + quotedstr(trim(Order_Main.fieldbyname('RRMID').AsString)));
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
InitGrid();
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.Tv1Column9PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName: string;
|
|||
|
begin
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
|
|||
|
if mvalue = '' then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update Trade_Cloth_RR_Main set ' + FFieldName + '=' + 'NULL');
|
|||
|
sql.Add('where RRMID=' + quotedstr(Trim(Order_Main.fieldbyname('RRMID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update Trade_Cloth_RR_Main set ' + FFieldName + '=' + quotedstr(Trim(mvalue)));
|
|||
|
sql.Add('where RRMID=' + quotedstr(Trim(Order_Main.fieldbyname('RRMID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
InitSubGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTradeRRList.v1Column7PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName: string;
|
|||
|
begin
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
with Order_Main do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update Trade_Cloth_RR_Main set ' + FFieldName + '=' + quotedstr(Trim(mvalue)));
|
|||
|
sql.Add('where RRMID=' + quotedstr(Trim(Order_Main.fieldbyname('RRMID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|