D7wmguihua/桂华管理系统/U_OrderJDList.pas
DESKTOP-E401PHE\Administrator b4b5840f18 1
2025-01-18 16:22:10 +08:00

447 lines
13 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_OrderJDList;
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, MovePanel;
type
TfrmOrderJDList = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
Label1: TLabel;
Label2: TLabel;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
DataSource1: TDataSource;
Label3: TLabel;
OrderNo: TEdit;
Order_Main: TClientDataSet;
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
v1OrderNo: TcxGridDBColumn;
v1Column2: TcxGridDBColumn;
v1DeliveryDate: TcxGridDBColumn;
v1Column5: TcxGridDBColumn;
v1FactoryNo1Name: TcxGridDBColumn;
v1PRTSpec: TcxGridDBColumn;
v1PRTMF: TcxGridDBColumn;
v1PRTKZ: TcxGridDBColumn;
v1Qty1: TcxGridDBColumn;
v1PRTOrderQty: TcxGridDBColumn;
v1OrderUnit: TcxGridDBColumn;
v1Column1: TcxGridDBColumn;
v1PRTUnit: TcxGridDBColumn;
v1Column4: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
v1Column7: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
v1Column8: TcxGridDBColumn;
v1Column9: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
v1Column6: TcxGridDBColumn;
v1Column11: TcxGridDBColumn;
v1Column12: TcxGridDBColumn;
v1Column13: TcxGridDBColumn;
v1Column14: TcxGridDBColumn;
v1Column15: TcxGridDBColumn;
v1Column16: TcxGridDBColumn;
v1Column17: TcxGridDBColumn;
v1Column18: TcxGridDBColumn;
v1Column19: TcxGridDBColumn;
v1Column20: TcxGridDBColumn;
v1Column21: TcxGridDBColumn;
Panel4: TPanel;
Label11: TLabel;
Panel10: TPanel;
Image2: TImage;
RichEdit1: TRichEdit;
MovePanel2: TMovePanel;
v1Column22: TcxGridDBColumn;
v1Column23: TcxGridDBColumn;
v1Column24: TcxGridDBColumn;
ToolButton1: TToolButton;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure TBFindClick(Sender: TObject);
procedure TBExportClick(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure OrderNoChange(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Tv2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
procedure Tv1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
procedure Image2Click(Sender: TObject);
procedure Panel10MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure ToolButton1Click(Sender: TObject);
procedure Tv1StylesGetContentStyle(Sender: TcxCustomGridTableView;
ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem;
out AStyle: TcxStyle);
procedure v1Column3CustomDrawCell(Sender: TcxCustomGridTableView;
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
var ADone: Boolean);
procedure v1Column6CustomDrawCell(Sender: TcxCustomGridTableView;
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
var ADone: Boolean);
procedure v1Column11CustomDrawCell(Sender: TcxCustomGridTableView;
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
var ADone: Boolean);
procedure v1Column14CustomDrawCell(Sender: TcxCustomGridTableView;
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
var ADone: Boolean);
procedure v1Column17CustomDrawCell(Sender: TcxCustomGridTableView;
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
var ADone: Boolean);
procedure v1Column20CustomDrawCell(Sender: TcxCustomGridTableView;
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
var ADone: Boolean);
private
FInt,PFInt:Integer;
FLeft,FTop:Integer;
procedure InitGrid();
procedure InitForm();
function DelData():Boolean;
{ Private declarations }
public
{ Public declarations }
end;
var
frmOrderJDList: TfrmOrderJDList;
implementation
uses
U_DataLink,U_ClothContractInPut,U_Fun,U_ProductOrderList,U_ZDYHelp,
U_OrderInPut;
{$R *.dfm}
procedure TfrmOrderJDList.FormDestroy(Sender: TObject);
begin
frmOrderJDList:=nil;
end;
procedure TfrmOrderJDList.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmOrderJDList.FormCreate(Sender: TObject);
begin
//BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp)-7;
//EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
end;
procedure TfrmOrderJDList.TBCloseClick(Sender: TObject);
begin
Close;
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȳ<EFBFBD>ѯ',Tv1,ʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmOrderJDList.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('exec P_View_OrderJD :begdate,:enddate,:Filler,:WSql');
if Trim(DParameters1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
Parameters.ParamByName('Filler').Value:=Trim(DName)
else
Parameters.ParamByName('Filler').Value:='';
Parameters.ParamByName('begdate').Value:=Trim(FormatDateTime('yyyy-MM-dd',BegDate.Date));
Parameters.ParamByName('enddate').Value:=Trim(FormatDateTime('yyyy-MM-dd',EndDate.Date+1));
Parameters.ParamByName('WSql').Value:='';
Open;
end;
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmOrderJDList.InitForm();
begin
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȳ<EFBFBD>ѯ',Tv1,ʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
BegDate.DateTime:=SGetServerDate10(ADOQueryTemp)-15;
EndDate.DateTime:=SGetServerDate10(ADOQueryTemp);
//InitGrid();
end;
procedure TfrmOrderJDList.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 TfrmOrderJDList.DelData():Boolean;
begin
end;
procedure TfrmOrderJDList.TBExportClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then Exit;
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD>Ϣ<EFBFBD><CFA2>',cxGrid1);
end;
procedure TfrmOrderJDList.TBRafreshClick(Sender: TObject);
begin
MovePanel2.Visible:=True;
MovePanel2.Refresh;
InitGrid();
MovePanel2.Visible:=False;
end;
procedure TfrmOrderJDList.OrderNoChange(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 TfrmOrderJDList.FormShow(Sender: TObject);
begin
InitForm();
end;
procedure TfrmOrderJDList.Tv2MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
FInt:=2;
end;
procedure TfrmOrderJDList.OrderNoKeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
begin
if Length(Trim(OrderNo.Text))<4 then Exit;
MovePanel2.Visible:=True;
MovePanel2.Refresh;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('exec P_View_OrderJD :begdate,:enddate,:Filler,:WSql');
if Trim(DParameters1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
Parameters.ParamByName('Filler').Value:=Trim(DName)
else
Parameters.ParamByName('Filler').Value:='';
Parameters.ParamByName('begdate').Value:='';
Parameters.ParamByName('enddate').Value:='';
Parameters.ParamByName('WSql').Value:=' and A.OrderNo like'''+'%'+Trim(OrderNo.Text)+'%'+'''';
Open;
end;
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end;
MovePanel2.Visible:=False;
end;
end;
procedure TfrmOrderJDList.Tv1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
FLeft:=X;
FTop:=Y;
end;
procedure TfrmOrderJDList.Tv1CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
begin
Panel4.Left:=FLeft;
Panel4.Top:=FTop+110;
Panel4.Visible:=True;
Panel4.Refresh;
Panel10.Caption:=Trim(TV1.Controller.FocusedColumn.Caption);
RichEdit1.Text:=Order_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString;
end;
procedure TfrmOrderJDList.Image2Click(Sender: TObject);
begin
Panel4.Visible:=False;
end;
procedure TfrmOrderJDList.Panel10MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
TWinControl(Panel4).Perform(WM_SYSCOMMAND,$F012,0);
end;
procedure TfrmOrderJDList.ToolButton1Click(Sender: TObject);
begin
if Order_Main.IsEmpty then Exit;
try
frmOrderInPut:=TfrmOrderInPut.Create(Application);
with frmOrderInPut do
begin
PState:=1;
FMainId:=Trim(Self.Order_Main.fieldbyname('MainId').AsString);
ToolBar2.Visible:=False;
TBSave.Visible:=False;
ScrollBox1.Enabled:=False;
Tv1.OptionsSelection.CellSelect:=False;
PriceFlag:=99;
if ShowModal=1 then
begin
end;
end;
finally
frmOrderInPut.Free;
end;
end;
procedure TfrmOrderJDList.Tv1StylesGetContentStyle(
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
var
id,id10:Integer;
begin
{try
if Tv1.GroupedItemCount=0 then
begin
Id:=Tv1.GetColumnByFieldName('DeliveryDate').Index-tv1.GroupedItemCount;
Id10:=Tv1.GetColumnByFieldName('SubStatus').Index-tv1.GroupedItemCount;
if Trim(VarToStr(ARecord.Values[id]))='' then Exit;
if Id<0 then Exit;
if ARecord.Values[id10]='<27><><EFBFBD><EFBFBD>' then exit;
if (ARecord.Values[id]-DQdate)>=4 then Exit;
if ((ARecord.Values[id]-DQdate)>=0) and ((ARecord.Values[id]-DQdate)<4) then
AStyle:=DataLink_.QHuangSe
else
if ARecord.Values[id]-DQdate<0 then
begin
AStyle:=DataLink_OrderManage.FenHongS;
end;
end else
begin
end;
except
end; }
end;
procedure TfrmOrderJDList.v1Column3CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
Id:Integer;
begin
Id:=TV1.GetColumnByFieldName('ClothHTQty').Index;//;-TV1.GroupedItemCount;
if Id<0 then Exit;
if AViewInfo.GridRecord.Values[Id]>0 then
begin
ACanvas.Brush.Color:=clRed;
end;
end;
procedure TfrmOrderJDList.v1Column6CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
Id:Integer;
begin
Id:=TV1.GetColumnByFieldName('ClothDHQty').Index;//;-TV1.GroupedItemCount;
if Id<0 then Exit;
if AViewInfo.GridRecord.Values[Id]>0 then
begin
ACanvas.Brush.Color:=clRed;
end;
end;
procedure TfrmOrderJDList.v1Column11CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
Id:Integer;
begin
Id:=TV1.GetColumnByFieldName('ClothTPQty').Index;//;-TV1.GroupedItemCount;
if Id<0 then Exit;
if AViewInfo.GridRecord.Values[Id]>0 then
begin
ACanvas.Brush.Color:=clRed;
end;
end;
procedure TfrmOrderJDList.v1Column14CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
Id:Integer;
begin
Id:=TV1.GetColumnByFieldName('ClothHCQty').Index;//;-TV1.GroupedItemCount;
if Id<0 then Exit;
if AViewInfo.GridRecord.Values[Id]>0 then
begin
ACanvas.Brush.Color:=clRed;
end;
end;
procedure TfrmOrderJDList.v1Column17CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
Id:Integer;
begin
Id:=TV1.GetColumnByFieldName('ClothRKQty').Index;//;-TV1.GroupedItemCount;
if Id<0 then Exit;
if AViewInfo.GridRecord.Values[Id]>0 then
begin
ACanvas.Brush.Color:=clRed;
end;
end;
procedure TfrmOrderJDList.v1Column20CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
Id:Integer;
begin
Id:=TV1.GetColumnByFieldName('ClothCKQty').Index;//;-TV1.GroupedItemCount;
if Id<0 then Exit;
if AViewInfo.GridRecord.Values[Id]>0 then
begin
ACanvas.Brush.Color:=clRed;
end;
end;
end.