281 lines
8.5 KiB
ObjectPascal
281 lines
8.5 KiB
ObjectPascal
![]() |
unit U_CKProductBCPKCHZList;
|
|||
|
|
|||
|
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, Clipbrd, cxLookAndFeels,
|
|||
|
cxLookAndFeelPainters, cxNavigator, RM_Dataset, RM_System, RM_Common, RM_Class,
|
|||
|
RM_GridReport;
|
|||
|
|
|||
|
type
|
|||
|
TfrmCKProductBCPKCHZListPB = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBExport: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
Label3: TLabel;
|
|||
|
C_CodeName: TEdit;
|
|||
|
Label2: TLabel;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
v2Column5: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
Label5: TLabel;
|
|||
|
ConNo: TEdit;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
MovePanel2: TMovePanel;
|
|||
|
Label1: TLabel;
|
|||
|
C_Code: TEdit;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
Label6: TLabel;
|
|||
|
apbatchno: TEdit;
|
|||
|
CheckBox1: TCheckBox;
|
|||
|
cv1Column5: TcxGridDBColumn;
|
|||
|
lbl1: TLabel;
|
|||
|
chejian: TComboBox;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDBMain: TRMDBDataSet;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
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 C_CodeNameChange(Sender: TObject);
|
|||
|
procedure v1Column5PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure CheckBox1Click(Sender: TObject);
|
|||
|
procedure chejianChange(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
private
|
|||
|
procedure InitGrid();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmCKProductBCPKCHZListPB: TfrmCKProductBCPKCHZListPB;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun, U_ZDYHelp, U_JYMXInfo;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCHZListPB.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmCKProductBCPKCHZListPB := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCHZListPB.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCHZListPB.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
// if CheckBox1.Checked then
|
|||
|
// begin
|
|||
|
//
|
|||
|
// sql.Add('select A.* ,C.BatchNoHZ,C.C_CodeName,C.C_Code,C.C_Color,C.ZhenCun,C.MFQty,C.KZQty,C.MF,C.KZ,C.C_Spec,C.KaiFu');
|
|||
|
// sql.Add(' ,CM.ConNo,CM.KHName');
|
|||
|
// sql.Add(' ,khjc=(select ZdyNameZ from KH_Zdy_Attachment X inner join JYOrderCon_Main_PB Y on Y.CustomerNo=X.ZdyCode and X.Type=''KHName'' where Y.ConNo=CM.XSConNo)');
|
|||
|
// sql.Add(' from(select Sum(KCKgQty) KCKgQty,count(*) JQty,PB.MainId,PB.SubId,PB.CarNo,PB.CHEJIAN,PB.APBatchNo ');
|
|||
|
// sql.Add(' from CK_PBCP_KC KC ');
|
|||
|
// sql.Add(' inner join CK_PBCP_CR A on KC.CRID=A.CRID and A.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
// sql.Add(' inner join WFB_MJJY_PB PB on KC.MJID=PB.MJID ');
|
|||
|
// sql.Add(' where KC.KCKGQty>0 group by PB.MainId,PB.SubId,PB.CarNo,PB.CHEJIAN,PB.APBatchNo ) A');
|
|||
|
// Sql.add(' inner join Cloth_Sub C on A.MainId=C.MainId');
|
|||
|
// sql.Add(' inner join Cloth_Main CM on CM.MainId=C.MainId ');
|
|||
|
//
|
|||
|
// end
|
|||
|
// else
|
|||
|
// begin
|
|||
|
sql.Add('select A.* ,C.BatchNoHZ,C.C_CodeName,C.C_Code,C.C_Color,C.ZhenCun,C.MF,C.KZ,C.C_Spec,C.KaiFu');
|
|||
|
sql.Add(' ,CM.ConNo,CM.KHName');
|
|||
|
// sql.Add(' ,khjc=(select ZdyNameZ from KH_Zdy_Attachment X inner join JYOrderCon_Main_PB Y on Y.CustomerNo=X.ZdyCode and X.Type=''KHName'' where Y.ConNo=CM.XSConNo)');
|
|||
|
sql.Add(' from(select Sum(KCKgQty) KCKgQty,count(*) JQty,PB.MainId,PB.SubId,PB.CHEJIAN,PB.APBatchNo,PB.ClothType ');
|
|||
|
sql.Add(' from CK_PBCP_KC KC ');
|
|||
|
sql.Add(' inner join CK_PBCP_CR A on KC.CRID=A.CRID and A.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add(' inner join WFB_MJJY_PB PB on KC.MJID=PB.MJID ');
|
|||
|
sql.Add(' where KC.KCKGQty>0 group by PB.MainId,PB.SubId,PB.CHEJIAN,PB.APBatchNo,PB.ClothType ) A');
|
|||
|
Sql.add(' left join Cloth_Sub C on A.MainId=C.MainId');
|
|||
|
sql.Add(' left join Cloth_Main CM on CM.MainId=C.MainId ');
|
|||
|
// end;
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCHZListPB.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
//BegDate.SetFocus;
|
|||
|
MovePanel2.Visible := True;
|
|||
|
MovePanel2.Refresh;
|
|||
|
InitGrid();
|
|||
|
MovePanel2.Visible := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCHZListPB.ConNoMChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCHZListPB.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('<27>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>PB', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCHZListPB.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
ReadCxGrid('<27>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>PB', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>');
|
|||
|
//InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCHZListPB.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
exit;
|
|||
|
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', cxGrid2);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCHZListPB.TBFindClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCHZListPB.C_CodeNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCHZListPB.v1Column5PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := 'SOrdDefStr10';
|
|||
|
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵص<C5B5>';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('SOrdDefStr10').Value := Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update JYOrder_Sub Set SOrdDefStr10=''' + Trim(ClientDataSet1.fieldbyname('ZdyName').AsString) + '''');
|
|||
|
sql.Add(' where SubId=''' + Trim(Self.CDS_Main.fieldbyname('SubId').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCHZListPB.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmJYMXInfo := TfrmJYMXInfo.Create(Application);
|
|||
|
with frmJYMXInfo do
|
|||
|
begin
|
|||
|
FFMainId := Trim(self.CDS_Main.fieldbyname('MainId').AsString);
|
|||
|
// FFClothType:=Trim(self.CDS_Main.fieldbyname('ClothType').AsString);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmJYMXInfo.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCHZListPB.CheckBox1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCHZListPB.chejianChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPKCHZListPB.ToolButton1Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
Porderno: string;
|
|||
|
i, j: Integer;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
ExportFtErpFile('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>.rmf', ADOQueryTemp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>.rmf';
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.DefaultCopies := 1;
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + trim(fPrintFile)), '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|