273 lines
7.1 KiB
ObjectPascal
273 lines
7.1 KiB
ObjectPascal
|
|
unit U_ClothGongYiListSel;
|
|||
|
|
|
|||
|
|
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, cxCalendar, cxButtonEdit, cxSplitter, RM_Common, RM_Class,
|
|||
|
|
RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, cxTextEdit, cxPC,
|
|||
|
|
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore,
|
|||
|
|
dxSkinsDefaultPainters, dxSkinscxPCPainter;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmClothGongYiListSel = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBFind: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
C_CodeName: TEdit;
|
|||
|
|
TBExport: TToolButton;
|
|||
|
|
Order_Main: TClientDataSet;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
RMXLSExport1: TRMXLSExport;
|
|||
|
|
CDS_PRT: TClientDataSet;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
v1Column2: TcxGridDBColumn;
|
|||
|
|
v1PRTMF: TcxGridDBColumn;
|
|||
|
|
v1PRTKZ: TcxGridDBColumn;
|
|||
|
|
v1Column4: TcxGridDBColumn;
|
|||
|
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
|
v1Column9: TcxGridDBColumn;
|
|||
|
|
RMDBPRT: TRMDBDataSet;
|
|||
|
|
TBView: TToolButton;
|
|||
|
|
v1Column21: TcxGridDBColumn;
|
|||
|
|
Label10: TLabel;
|
|||
|
|
C_Code: TEdit;
|
|||
|
|
v1Column20: TcxGridDBColumn;
|
|||
|
|
v1Column1: TcxGridDBColumn;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
GongYiCode: TEdit;
|
|||
|
|
v1Column3: TcxGridDBColumn;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
YZConNo: TEdit;
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure TBFindClick(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure ConNoChange(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure TBViewClick(Sender: TObject);
|
|||
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure Tv1DblClick(Sender: TObject);
|
|||
|
|
procedure TBExportClick(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
FInt, PFInt: Integer;
|
|||
|
|
procedure InitGrid();
|
|||
|
|
procedure InitForm();
|
|||
|
|
function DelData(): Boolean;
|
|||
|
|
procedure InitButton();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
canshu1, FCheJian: string;
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmClothGongYiListSel: TfrmClothGongYiListSel;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_ClothSCInPut, U_Fun, U_ZDYHelp, U_SCPerson, U_ClothSCInPutSC,
|
|||
|
|
U_ClothGYInPut;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmClothGongYiListSel.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Action := caHide;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmClothGongYiListSel.InitButton();
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmClothGongYiListSel.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
WriteCxGrid(Self.Caption, Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmClothGongYiListSel.InitGrid();
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select B.* ');
|
|||
|
|
sql.Add(' ,YZConNo=cast((select '' ''+ X.ConNo from Cloth_Main X inner join Cloth_Sub Y on X.MainId=Y.MainId ');
|
|||
|
|
sql.Add(' where Y.GongYiCode=B.GongYiCode order by X.filltime desc for xml path('''')) as varchar(6000))'); // DATEDIFF(MONTH,X.Filltime,getdate())<7 and
|
|||
|
|
sql.Add(' from CLoth_GY B ');
|
|||
|
|
sql.Add(' where QYFlag=1 and valid=''Y'' ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmClothGongYiListSel.InitForm();
|
|||
|
|
begin
|
|||
|
|
InitButton();
|
|||
|
|
ReadCxGrid(Self.Caption, Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmClothGongYiListSel.TBFindClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active = False then
|
|||
|
|
Exit;
|
|||
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmClothGongYiListSel.DelData(): Boolean;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
Result := false;
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete Cloth_Sub where SubId=''' + Trim(Order_Main.fieldbyname('SubId').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Cloth_Sub where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete Cloth_Main where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if Trim(Order_Main.fieldbyname('SubId').AsString) = '' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete Cloth_Main where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete Cloth_PaiZhen where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete Cloth_YCL_PB where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
Result := True;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Result := False;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmClothGongYiListSel.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmClothGongYiListSel.ConNoChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active = False then
|
|||
|
|
Exit;
|
|||
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
|
SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmClothGongYiListSel.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitForm();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmClothGongYiListSel.TBViewClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmClothGYInPut := TfrmClothGYInPut.Create(Application);
|
|||
|
|
with frmClothGYInPut do
|
|||
|
|
begin
|
|||
|
|
TBSave.Visible := False;
|
|||
|
|
ToolBar3.Visible := False;
|
|||
|
|
cxPageControl1.Visible := False;
|
|||
|
|
PState := 1;
|
|||
|
|
FSubId := Trim(Self.Order_Main.fieldbyname('GYId').AsString);
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmClothGYInPut.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmClothGongYiListSel.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitButton();
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmClothGongYiListSel.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmClothGongYiListSel := nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmClothGongYiListSel.Tv1DblClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
ModalResult := 1;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmClothGongYiListSel.TBExportClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
ModalResult := 1;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|