315 lines
8.7 KiB
ObjectPascal
315 lines
8.7 KiB
ObjectPascal
![]() |
unit U_ClothCLJTCXList;
|
|||
|
|
|||
|
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,
|
|||
|
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore,
|
|||
|
dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu;
|
|||
|
|
|||
|
type
|
|||
|
TfrmClothCLJTCXList = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
TBExport: TToolButton;
|
|||
|
Order_Main: TClientDataSet;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
CDS_PRT: TClientDataSet;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
RMDBPRT: TRMDBDataSet;
|
|||
|
RMDBPZ: TRMDBDataSet;
|
|||
|
CDS_PZ: TClientDataSet;
|
|||
|
CDS_SJ: TClientDataSet;
|
|||
|
RMDBSJ: TRMDBDataSet;
|
|||
|
v1Column24: TcxGridDBColumn;
|
|||
|
RMDBDataSet1: TRMDBDataSet;
|
|||
|
ClientDataSet1: TClientDataSet;
|
|||
|
CDS_WJG: TClientDataSet;
|
|||
|
RMDBWJG: TRMDBDataSet;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
Panel1: TPanel;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure TBFindClick(Sender: TObject);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure TBAddClick(Sender: TObject);
|
|||
|
procedure ConNoChange(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
// procedure conPress(Sender: TObject; var Key: Char);
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView;
|
|||
|
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
|
|||
|
var ADone: Boolean);
|
|||
|
private
|
|||
|
FInt, PFInt: Integer;
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitForm();
|
|||
|
function DelData(): Boolean;
|
|||
|
procedure InitButton();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
canshu1, FCheJian, FMainId,FCarNo: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmClothCLJTCXList: TfrmClothCLJTCXList;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp;
|
|||
|
//U_ClothSCInPutSC ,U_ClothSCInPut ,U_SCPerson
|
|||
|
|
|||
|
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmClothCLJTCXList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothCLJTCXList.InitButton();
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothCLJTCXList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothCLJTCXList.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
//sql.Add('select * from WFB_MJJY_PB WHERE');
|
|||
|
sql.add('SELECT B.MJID,B.APID, B.MJSTR2,B.MJSTR4,B.carno,b.mjmaoz,A.XHINT,B.FILLTIME FROM WFB_MJJY_pb B LEFT JOIN JYCon_Sub_AnPai A on B.APID=A.APID where ') ;
|
|||
|
//Sql.Add('select B.MAINID,B.MJID,B.MJMAOZ,B.MJSTR2,B.MJSTR4,B.CARNO,A.XHINT from JYCon_Sub_AnPai A INNER JOIN WFB_MJJY_PB B ON A.APID=B.MJID WHERE') ;
|
|||
|
SQL.Add(' B.MAINID='+QuotedStr(FMainID) );
|
|||
|
//SQL.Add('select CARNO,MJMAOZ,MJID,MAINID from WFB_MJJY_PB where MAINID=''' + Trim(MAINID) + '''');
|
|||
|
// sql.Add(' and CarNo=''' + Trim(CarNo) + '''');
|
|||
|
SQL.Add(' and B.CarNo='+QuotedStr(FCarNo) );
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryMain, Order_Main);
|
|||
|
SInitCDSData(ADOQueryMain, Order_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothCLJTCXList.InitForm();
|
|||
|
begin
|
|||
|
InitButton();
|
|||
|
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
//BegDate.DateTime := SGetServerDate10(ADOQueryTemp) - 7;
|
|||
|
//EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothCLJTCXList.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;
|
|||
|
|
|||
|
function TfrmClothCLJTCXList.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 TfrmClothCLJTCXList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
Exit;
|
|||
|
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', cxGrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothCLJTCXList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothCLJTCXList.TBAddClick(Sender: TObject);
|
|||
|
begin
|
|||
|
//
|
|||
|
// try
|
|||
|
// frmClothSCInPut := TfrmClothSCInPut.Create(Application);
|
|||
|
// with frmClothSCInPut do
|
|||
|
// begin
|
|||
|
// PState := 0;
|
|||
|
// FMainId := '';
|
|||
|
// FSubId := '';
|
|||
|
// if ShowModal = 1 then
|
|||
|
// begin
|
|||
|
// InitGrid();
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// finally
|
|||
|
// frmClothSCInPut.Free;
|
|||
|
// end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothCLJTCXList.ConNoChange(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 TfrmClothCLJTCXList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
InitForm();
|
|||
|
end;
|
|||
|
|
|||
|
//procedure TfrmClothCLCXList.conPress(Sender: TObject; var Key: Char);
|
|||
|
//begin
|
|||
|
// if Key = #13 then
|
|||
|
// begin
|
|||
|
// if Length(Trim(ConNo.Text)) < 4 then
|
|||
|
// Exit;
|
|||
|
// try
|
|||
|
// ADOQueryMain.DisableControls;
|
|||
|
// with ADOQueryMain do
|
|||
|
// begin
|
|||
|
// Filtered := False;
|
|||
|
// Close;
|
|||
|
// sql.Clear;
|
|||
|
// //sql.Add('exec Cloth_QryList :MainId,:WSql');
|
|||
|
// // Parameters.ParamByName('WSql').Value:=' and OM.conNo like '''+'%'+Trim(ConNoM.Text)+'%'+''''
|
|||
|
// // +' and ConType=''<27><><EFBFBD><EFBFBD>'' ';
|
|||
|
// sql.Add('select * from Cloth_Main A inner join CLoth_Sub B on A.Mainid=B.MainId');
|
|||
|
// sql.Add(' where A.ConNo like ''' + '%' + Trim(ConNo.Text) + '%' + '''');
|
|||
|
//
|
|||
|
// Open;
|
|||
|
// end;
|
|||
|
// SCreateCDS20(ADOQueryMain, Order_Main);
|
|||
|
// SInitCDSData20(ADOQueryMain, Order_Main);
|
|||
|
// finally
|
|||
|
// ADOQueryMain.EnableControls;
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
//end;
|
|||
|
|
|||
|
procedure TfrmClothCLJTCXList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmClothCLJTCXList := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothCLJTCXList.Tv1CustomDrawCell(
|
|||
|
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
|||
|
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
var
|
|||
|
FMJSTR4: string;
|
|||
|
begin
|
|||
|
|
|||
|
if AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('MJSTR4').Index] = null then
|
|||
|
Exit;
|
|||
|
|
|||
|
FMJSTR4 := AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('MJSTR4').Index];
|
|||
|
|
|||
|
if FMJSTR4 = 'δ<><CEB4><EFBFBD><EFBFBD>' then
|
|||
|
ACanvas.Font.Color :=$FF0000;
|
|||
|
if FMJSTR4 = '<27>ѳ<EFBFBD><D1B3><EFBFBD>' then
|
|||
|
ACanvas.Font.Color := $0000FF;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
end.
|
|||
|
|