1454 lines
43 KiB
ObjectPascal
1454 lines
43 KiB
ObjectPascal
unit U_CKProductCPOutList;
|
||
|
||
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, RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System,
|
||
RM_GridReport, cxCheckBox, Menus, MovePanel, cxCalendar, Math, Clipbrd,
|
||
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore,
|
||
dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, U_BaseList, cxTextEdit,
|
||
cxPC;
|
||
|
||
type
|
||
TfrmCKProductCPOutList = class(TfrmBaseList)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBExport: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
Label2: TLabel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
CDS_Main: TClientDataSet;
|
||
RMXLSExport1: TRMXLSExport;
|
||
TBCKCX: TToolButton;
|
||
MovePanel2: TMovePanel;
|
||
GPM_1: TcxGridPopupMenu;
|
||
begtime: TDateTimePicker;
|
||
endTime: TDateTimePicker;
|
||
ADOQueryPrint: TADOQuery;
|
||
RMDB_Main: TRMDBDataSet;
|
||
RMDBHZ: TRMDBDataSet;
|
||
CDS_HZ: TClientDataSet;
|
||
RM1: TRMGridReport;
|
||
IsJYTime: TCheckBox;
|
||
ToolButton1: TToolButton;
|
||
ToolButton2: TToolButton;
|
||
CDS_Label: TClientDataSet;
|
||
ToolButton3: TToolButton;
|
||
CDS_PRT: TClientDataSet;
|
||
cxPageControl1: TcxPageControl;
|
||
cxTabSheet1: TcxTabSheet;
|
||
cxGrid2: TcxGrid;
|
||
TV2: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
cxGridDBColumn6: TcxGridDBColumn;
|
||
cxGridDBColumn27: TcxGridDBColumn;
|
||
cxGridDBColumn28: TcxGridDBColumn;
|
||
cxGridDBColumn7: TcxGridDBColumn;
|
||
cxGridDBColumn37: TcxGridDBColumn;
|
||
cxGridDBColumn41: TcxGridDBColumn;
|
||
cxGridDBColumn31: TcxGridDBColumn;
|
||
cxGridDBColumn11: TcxGridDBColumn;
|
||
cxGridDBColumn13: TcxGridDBColumn;
|
||
cxGridDBColumn14: TcxGridDBColumn;
|
||
cxGridDBColumn15: TcxGridDBColumn;
|
||
cxGridDBColumn16: TcxGridDBColumn;
|
||
cxGridDBColumn18: TcxGridDBColumn;
|
||
cxGridDBColumn19: TcxGridDBColumn;
|
||
cxGridDBColumn20: TcxGridDBColumn;
|
||
cxGridDBColumn40: TcxGridDBColumn;
|
||
cxGridDBColumn21: TcxGridDBColumn;
|
||
cxGridDBColumn32: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
cxTabSheet2: TcxTabSheet;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Column11: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column23: TcxGridDBColumn;
|
||
v2Column1: TcxGridDBColumn;
|
||
v2Column3: TcxGridDBColumn;
|
||
v1Column18: TcxGridDBColumn;
|
||
v1Column12: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column15: TcxGridDBColumn;
|
||
v2Column5: TcxGridDBColumn;
|
||
v1Column21: TcxGridDBColumn;
|
||
v2Column6: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column19: TcxGridDBColumn;
|
||
v1Column20: TcxGridDBColumn;
|
||
v1Column22: TcxGridDBColumn;
|
||
v1rkplace: TcxGridDBColumn;
|
||
v1Column24: TcxGridDBColumn;
|
||
v1Column14: TcxGridDBColumn;
|
||
v1Column16: TcxGridDBColumn;
|
||
v1Column17: TcxGridDBColumn;
|
||
Tv1Column3: TcxGridDBColumn;
|
||
Tv1Column4: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
Panel6: TPanel;
|
||
Label31: TLabel;
|
||
LBCPAP: TLabel;
|
||
BTLP: TButton;
|
||
BTNP: TButton;
|
||
TCBNOR: TComboBox;
|
||
GPM_2: TcxGridPopupMenu;
|
||
CDS_2: TClientDataSet;
|
||
DS_2: TDataSource;
|
||
Label3: TLabel;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
Label7: TLabel;
|
||
Label10: TLabel;
|
||
Label12: TLabel;
|
||
Label14: TLabel;
|
||
Label16: TLabel;
|
||
Label11: TLabel;
|
||
Label13: TLabel;
|
||
Label19: TLabel;
|
||
Label1: TLabel;
|
||
P_CodeName: TEdit;
|
||
orderNo: TEdit;
|
||
JYType: TComboBox;
|
||
ToKHName1: TEdit;
|
||
conNo: TEdit;
|
||
APID: TEdit;
|
||
P_Color: TEdit;
|
||
GangNo: TEdit;
|
||
P_HX: TEdit;
|
||
P_Code: TEdit;
|
||
JYID: TEdit;
|
||
ToolButton4: TToolButton;
|
||
TV2Column1: TcxGridDBColumn;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
Label6: TLabel;
|
||
GUINO: TEdit;
|
||
TV2Column2: TcxGridDBColumn;
|
||
Panel4: TPanel;
|
||
Label20: TLabel;
|
||
Panel10: TPanel;
|
||
Image2: TImage;
|
||
Button1: TButton;
|
||
RadioGroup1: TRadioGroup;
|
||
TV2Column3: TcxGridDBColumn;
|
||
Tv1Column2: TcxGridDBColumn;
|
||
CDS_MXHZ: TClientDataSet;
|
||
RMDBMXHZ: TRMDBDataSet;
|
||
RMDBMX: TRMDBDataSet;
|
||
CDS_MX: TClientDataSet;
|
||
ADOQuery1: TADOQuery;
|
||
BAOID: TEdit;
|
||
Label8: TLabel;
|
||
Label9: TLabel;
|
||
JYNW: TEdit;
|
||
JYLen: TEdit;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
PopupMenu2: TPopupMenu;
|
||
MenuItem1: TMenuItem;
|
||
MenuItem2: TMenuItem;
|
||
Label15: TLabel;
|
||
p_colorno: TEdit;
|
||
TV2Column4: TcxGridDBColumn;
|
||
Tv1Column5: TcxGridDBColumn;
|
||
Label17: TLabel;
|
||
LOTNO: TEdit;
|
||
TV2Column5: TcxGridDBColumn;
|
||
Tv1Column6: TcxGridDBColumn;
|
||
CDS_CKNO: TClientDataSet;
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ConNoMChange(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBCKCXClick(Sender: TObject);
|
||
procedure orderNoKeyPress(Sender: TObject; var Key: Char);
|
||
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
procedure BTNPClick(Sender: TObject);
|
||
procedure BTLPClick(Sender: TObject);
|
||
procedure TCBNORChange(Sender: TObject);
|
||
procedure CPTypeChange(Sender: TObject);
|
||
procedure CRTypeChange(Sender: TObject);
|
||
procedure edtSMNOKeyPress(Sender: TObject; var Key: Char);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure TV2DblClick(Sender: TObject);
|
||
procedure cxPageControl1Change(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure Image2Click(Sender: TObject);
|
||
procedure JYTypeChange(Sender: TObject);
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure MenuItem1Click(Sender: TObject);
|
||
procedure MenuItem2Click(Sender: TObject);
|
||
private
|
||
FLeft, FTop: Integer;
|
||
CurrentPage, RecordsNumber: Integer;
|
||
procedure InitGrid();
|
||
procedure SetStatus();
|
||
procedure GetLabel();
|
||
procedure PrintMD(MStatus: string);
|
||
{ Private declarations }
|
||
public
|
||
canshu1, CANSHU2: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
//var
|
||
// frmCKProductBCPOutList: TfrmCKProductBCPOutList;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_LbaelMap;
|
||
|
||
{$R *.dfm}
|
||
procedure TfrmCKProductCPOutList.GetLabel();
|
||
var
|
||
fsj: string;
|
||
begin
|
||
|
||
fsj := 'select distinct(LMName) name from Lbael_Map where LMType=''<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>뵥'' ';
|
||
if canshu1 = '<27><>ѯ' then
|
||
begin
|
||
fsj := fsj + 'and lmname<>''Custom Packing List'' ';
|
||
end;
|
||
SInitRadioGroupBySql(ADOQueryCmd, RadioGroup1, true, fsj);
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
Sql.Add('select * from Lbael_Map where LMType=''<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>뵥''');
|
||
|
||
// ShowMessage(SQL.Text);
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, CDS_Label);
|
||
SInitCDSData(ADOQueryTemp, CDS_Label);
|
||
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.SetStatus();
|
||
begin
|
||
TBCKCX.Enabled := False;
|
||
|
||
case cxPageControl1.ActivePageIndex of
|
||
0:
|
||
begin
|
||
ClearOrHideControls(Panel1, '0', True, True);
|
||
ClearOrHideControls(Panel1, '1', True, False);
|
||
end;
|
||
1:
|
||
begin
|
||
ClearOrHideControls(Panel1, '0', false, True);
|
||
ClearOrHideControls(Panel1, '1', True, True);
|
||
// if canshu1 = '<27><><EFBFBD><EFBFBD>' then
|
||
// begin
|
||
//
|
||
TBCKCX.Enabled := True;
|
||
//
|
||
// end;
|
||
end;
|
||
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.PrintMD(MStatus: string);
|
||
var
|
||
fImagePath2, fPrintFile, fPrintFile10, FMainID, FKHName, FFPNo, LBName: string;
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete TBSubID where DName=''' + Trim(DCode) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('SELECT * FROM TBSubID where 1=2 ');
|
||
open;
|
||
end;
|
||
FMainID := '';
|
||
CDS_Main.DisableControls;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with CDS_Main do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Fieldbyname('Ssel').AsBoolean then
|
||
begin
|
||
ADOQueryCmd.append;
|
||
ADOQueryCmd.fieldbyname('SubId').Value := Trim(CDS_Main.fieldbyname('JYID').AsString);
|
||
ADOQueryCmd.fieldbyname('Dname').Value := Trim(DCode);
|
||
ADOQueryCmd.post;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
end;
|
||
CDS_Main.EnableControls;
|
||
|
||
LBName := RadioGroup1.Items.Strings[RadioGroup1.ItemIndex];
|
||
ExportFtErpFile(LBName + '.rmf', ADOQueryTemp);
|
||
|
||
if CDS_Label.Locate('LMName', trim(LBName), []) then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql').AsString) + ' @code=' + quotedstr(Trim(DCode)));
|
||
// sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql').AsString) + ' @CKOrdNo=' + quotedstr(Trim(CDS_Main.fieldbyname('CKOrdNo').AsString)));
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_PRT);
|
||
SInitCDSData(ADOQueryPrint, CDS_PRT);
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_Print_CKMD_DXHZ @code=' + quotedstr(Trim(DCode)));
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_HZ);
|
||
SInitCDSData(ADOQueryPrint, CDS_HZ);
|
||
end;
|
||
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(LBName) + '.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
if MStatus = 'Excel' then
|
||
begin
|
||
RM1.LoadFromFile(fPrintFile);
|
||
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label0001.xls';
|
||
if FileExists(fImagePath2) then
|
||
DeleteFile(fImagePath2);
|
||
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label.xls';
|
||
RM1.PrepareReport;
|
||
RM1.ExportTo(RMXLSExport1, fImagePath2);
|
||
end
|
||
else
|
||
begin
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RMVariables['ZDR'] := trim(DName);
|
||
RM1.ShowReport;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD>ҵ<EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.FormCreate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
|
||
BegDate.DateTime := EndDate.DateTime - 20;
|
||
canshu2 := Trim(DParameters2);
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.FormDestroy(Sender: TObject);
|
||
begin
|
||
//<2F><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>
|
||
inherited;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.Image2Click(Sender: TObject);
|
||
begin
|
||
Panel4.Visible := false;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.InitGrid();
|
||
var
|
||
WSql: string;
|
||
begin
|
||
MovePanel2.Left := (self.Width - MovePanel2.Width) div 2;
|
||
MovePanel2.Visible := True;
|
||
MovePanel2.Refresh;
|
||
WSql := SGetFilters(Panel1, 1, 2);
|
||
if Trim(WSql) <> '' then
|
||
WSql := ' and ' + WSql;
|
||
if IsJYTime.Checked then
|
||
begin
|
||
WSql := WSql + ' and CRTime>=' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime));
|
||
WSql := WSql + ' and CRTime<' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1));
|
||
end;
|
||
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
case cxPageControl1.ActivePageIndex of
|
||
0:
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
|
||
sql.Add('select LOTNO,A.CKNO,A.OrderNo,subid,A.ConNo,A.P_Code,A.P_CodeName,A.P_Spec,A.P_Color,A.P_ColorNo,A.P_KuanNo,A.P_MF,GUINO,A.P_KZ,A.P_HX,A.APID,A.GangNo,A.RCGangNo ');
|
||
SQL.Add(',BS=(SELECT COUNT(DISTINCT BAONO) FROM V_Cloth_CP_CK C WHERE C.APID=A.APID)');
|
||
sql.Add(' ,sum(A.JYGW) JYGW, sum(A.JYTare) JYTare, sum(A.JYNW) JYNW,sum(A.JYLen) JYLen, sum(A.JYYLen) JYYLen ');
|
||
SQL.Add(',TOKHNAME=(SELECT zkhname from fhsq_sub b where b.fsid=a.ckno and b.subid=a.subid )');
|
||
sql.Add('from V_Cloth_CP_CK A ');
|
||
sql.Add('where 1=1 ' + (WSql));
|
||
sql.Add('and exists(select jyid from jy_cloth E WHERE E.JYID=A.JYID AND E.fdanwei= ' + QuotedStr(Trim(canshu2)));
|
||
sql.Add(')');
|
||
sql.Add('group by LOTNO,A.CKNO,subid,A.OrderNo,A.ConNo,A.P_Code,A.P_CodeName,A.P_Spec,A.P_Color,A.P_ColorNo,A.P_KuanNo,A.P_MF,GUINO,A.P_KZ,A.P_HX,A.APID,A.GangNo,A.RCGangNo ');
|
||
// ShowMessage(SQL.Text);
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryMain, CDS_2);
|
||
SInitCDSData(ADOQueryMain, CDS_2);
|
||
end;
|
||
1:
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select top ' + inttostr(RecordsNumber) + ' * ');
|
||
sql.Add(' ,DJBRCGangNo =(select X.RCGangNo from CK_SXPB_CR X where X.SPID=temp_row.APID)');
|
||
sql.Add(' from ');
|
||
sql.Add('(select rownumber=cast((row_number() over(order by AA.filltime desc)) as int)');
|
||
sql.Add(',COUNT(1) OVER() AS TotalCount');
|
||
sql.Add(',*,TOKHNAME=(SELECT zkhname from fhsq_sub b where b.fsid=aa.ckno and b.subid=aa.subid ) from V_Cloth_CP_CK AA where 1=1 ' + WSql);
|
||
sql.Add('and exists(select jyid from jy_cloth E WHERE E.JYID=AA.JYID AND E.fdanwei= ' + QuotedStr(Trim(canshu2)));
|
||
sql.Add(')');
|
||
sql.Add(') temp_row');
|
||
sql.Add(' where rownumber> ' + inttostr(((CurrentPage - 1) * RecordsNumber)));
|
||
sql.Add(' order by rownumber');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryMain, CDS_Main);
|
||
SInitCDSData(ADOQueryMain, CDS_Main);
|
||
LBCPAP.Caption := inttostr(CurrentPage) + '/' + inttostr(ceil(CDS_Main.FieldByName('TotalCount').AsInteger / RecordsNumber));
|
||
end;
|
||
end;
|
||
MovePanel2.Visible := false;
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
MovePanel2.Visible := false;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.JYTypeChange(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
CurrentPage := 1;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.MenuItem1Click(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
SelOKNoFiler(tv1, true);
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.MenuItem2Click(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
SelOKNoFiler(tv1, false);
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.N1Click(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
SelOKNoFiler(tv2, true);
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.N2Click(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
SelOKNoFiler(tv2, false);
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
CurrentPage := 1;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.ConNoMChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(trim(self.Caption) + 'Tv1', Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
WriteCxGrid(trim(self.Caption) + '1Tv2', Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
canshu1 := Trim(Self.fParameters1);
|
||
ReadCxGrid(trim(self.Caption) + 'Tv1', Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
ReadCxGrid(trim(self.Caption) + '1Tv2', Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
CurrentPage := 1;
|
||
RecordsNumber := 500;
|
||
SetStatus();
|
||
GetLabel();
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.TBCKCXClick(Sender: TObject);
|
||
//var
|
||
// FFMainId, FPrice, strsql: string;
|
||
//begin
|
||
// if CDS_Main.IsEmpty then
|
||
// Exit;
|
||
// if CDS_Main.Locate('SSel', True, []) = False then
|
||
// begin
|
||
// Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
// Exit;
|
||
// end;
|
||
// if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
// Exit;
|
||
// MovePanel2.Visible := True;
|
||
// MovePanel2.Refresh;
|
||
// try
|
||
// ADOQueryCmd.Connection.BeginTrans;
|
||
// CDS_Main.DisableControls;
|
||
// with CDS_Main do
|
||
// begin
|
||
// while CDS_Main.Locate('SSel', True, []) = True do
|
||
// begin
|
||
// begin
|
||
// with ADOQueryCmd do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.Add('Update CK_Cloth_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ,CRType='''',CRTime=NULL ,CKNo='''' ');
|
||
// sql.Add(' where JYID=''' + Trim(CDS_Main.fieldbyname('JYID').AsString) + '''');
|
||
// sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
|
||
//
|
||
// sql.Add(' UPdate CK_Cloth_KC Set Valid=''Y'' ');
|
||
// SQL.Add(' where JYID=''' + Trim(CDS_Main.fieldbyname('JYID').AsString) + '''');
|
||
//
|
||
// sql.Add(' Update JY_Cloth Set JYCRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' where JYID=''' + Trim(CDS_Main.fieldbyname('JYID').AsString) + ''' ');
|
||
//
|
||
// ExecSQL;
|
||
// end;
|
||
//
|
||
// strsql := '<27><>ID<49><44>' + trim(CDS_Main.FieldByName('JYID').AsString) + ' <20><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('CKNo').AsString);
|
||
//
|
||
// with ADOQueryCmd do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
||
// sql.Add(' ' + quotedstr(trim(DName)));
|
||
// sql.Add(',getdate() ');
|
||
// sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
// sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><E2B3B7>')));
|
||
// sql.Add(',' + quotedstr(trim(strsql)));
|
||
// sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
// sql.Add(')');
|
||
// ExecSQL;
|
||
// end;
|
||
// with ADOQueryCmd do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.Add('exec P_FH_UP_FHQty ''' + Trim(Trim(CDS_Main.fieldbyname('CKNo').AsString)) + '''');
|
||
// ExecSQL;
|
||
// end;
|
||
// CDS_Main.Delete;
|
||
// end;
|
||
// end;
|
||
// end;
|
||
// CDS_Main.EnableControls;
|
||
//
|
||
// ADOQueryCmd.Connection.CommitTrans;
|
||
// MovePanel2.Visible := False;
|
||
// Exit;
|
||
// except
|
||
// MovePanel2.Visible := False;
|
||
// CDS_Main.EnableControls;
|
||
// ADOQueryCmd.Connection.RollbackTrans;
|
||
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
// end;
|
||
var
|
||
FFMainId, FPrice, strsql, WSql, WLog: string;
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
if CDS_Main.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
WSql := '';
|
||
WLog := '';
|
||
MovePanel2.Visible := True;
|
||
MovePanel2.Refresh;
|
||
|
||
CDS_Main.DisableControls;
|
||
with CDS_Main do
|
||
begin
|
||
while CDS_Main.Locate('SSel', True, []) = True do
|
||
begin
|
||
begin
|
||
|
||
if WSql = '' then
|
||
WSql := quotedstr(Trim(CDS_Main.fieldbyname('JYID').AsString))
|
||
else
|
||
WSql := WSql + ',' + quotedstr(Trim(CDS_Main.fieldbyname('JYID').AsString));
|
||
|
||
strsql := '<27><>ID<49><44>' + trim(CDS_Main.FieldByName('JYID').AsString) + ' <20><><EFBFBD>ⵥ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('CKNO').AsString);
|
||
|
||
WLog := WLog + ' insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ';
|
||
WLog := WLog + ' ' + quotedstr(trim(DName));
|
||
WLog := WLog + ' ,getdate() ';
|
||
WLog := WLog + ' ,' + quotedstr(trim(self.Caption));
|
||
WLog := WLog + ' ,' + quotedstr(trim('<27><><EFBFBD><EFBFBD><E2B3B7>'));
|
||
WLog := WLog + ' ,' + quotedstr(trim(strsql));
|
||
WLog := WLog + ' ,' + quotedstr(trim('<27>ɹ<EFBFBD>')) + ' )';
|
||
|
||
CDS_Main.Delete;
|
||
end;
|
||
end;
|
||
end;
|
||
CDS_Main.EnableControls;
|
||
|
||
if WSql = '' then
|
||
begin
|
||
MovePanel2.Visible := False;
|
||
exit;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select distinct ckno from CK_Cloth_CR ');
|
||
sql.Add(' where jyid in (' + WSql + ')');
|
||
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
|
||
open;
|
||
end;
|
||
|
||
SCreateCDS(ADOQueryTemp, CDS_CKNO);
|
||
SInitCDSData(ADOQueryTemp, CDS_CKNO);
|
||
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(WLog);
|
||
ExecSQL;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update CK_Cloth_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ,CRType='''',CRTime=NULL ,CKNo='''' ');
|
||
sql.Add(' where JYID in (' + WSql + ')');
|
||
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
|
||
|
||
sql.Add(' UPdate CK_Cloth_KC Set Valid=''Y'' ');
|
||
sql.Add(' where JYID in (' + WSql + ')');
|
||
|
||
sql.Add(' Update JY_Cloth Set JYCRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(' where JYID in (' + WSql + ')');
|
||
|
||
// sql.Add('Update CK_BanCP_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',SQKHKuanHao=NULL,CRType='''',CRTime=NULL,CRNote='''',CKOrdNo='''' ');
|
||
// sql.Add(' where MJID in (' + WSql + ')');
|
||
// sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
|
||
//
|
||
// sql.Add(' UPdate CK_BanCP_KC Set KCValid=''Y'' ');
|
||
// SQL.Add(' where MJID in (' + WSql + ')');
|
||
//
|
||
// sql.Add(' Update WFB_MJJY Set MJStr2=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' where MJID in (' + WSql + ')');
|
||
|
||
ExecSQL;
|
||
end;
|
||
|
||
with CDS_CKNO do
|
||
begin
|
||
first;
|
||
while not eof do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_FH_UP_FHQty ''' + Trim(Trim(CDS_CKNO.fieldbyname('CKNo').AsString)) + '''');
|
||
ExecSQL;
|
||
end;
|
||
next;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
MovePanel2.Visible := False;
|
||
Exit;
|
||
except
|
||
MovePanel2.Visible := False;
|
||
CDS_Main.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.orderNoKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
CurrentPage := 1;
|
||
InitGrid();
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
// Clipboard.SetTextBuf(PChar(Trim(CDS_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.Tv1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
FLeft := X;
|
||
FTop := Y;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.TV2DblClick(Sender: TObject);
|
||
begin
|
||
AssignmentControls(Panel1, CDS_2, '0');
|
||
cxPageControl1.ActivePageIndex := 1;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.BTNPClick(Sender: TObject);
|
||
begin
|
||
if CurrentPage < CDS_Main.FieldByName('TotalCount').AsInteger / RecordsNumber then
|
||
CurrentPage := CurrentPage + 1;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.Button1Click(Sender: TObject);
|
||
var
|
||
fPrintFile, fPrintFile10, FMainID, LBName: string;
|
||
FORDERNO, fckno, fkhname: string;
|
||
begin
|
||
|
||
|
||
// if CDS_Main.IsEmpty then
|
||
// Exit;
|
||
// if CDS_Main.Locate('SSel', True, []) = False then
|
||
// begin
|
||
// Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
// Exit;
|
||
// end;
|
||
|
||
|
||
if (CDS_Main.IsEmpty) and (cds_2.IsEmpty) then
|
||
Exit;
|
||
|
||
LBName := RadioGroup1.Items.Strings[RadioGroup1.ItemIndex];
|
||
ExportFtErpFile(LBName + '.rmf', ADOQueryTemp);
|
||
if cxPageControl1.ActivePageIndex = 0 then
|
||
begin
|
||
FORDERNO := cds_2.fieldbyname('ORDERNO').AsString;
|
||
fckno := cds_2.fieldbyname('ckno').AsString;
|
||
fkhname := cds_2.fieldbyname('tokhname').AsString;
|
||
end
|
||
else if cxPageControl1.ActivePageIndex = 1 then
|
||
begin
|
||
FORDERNO := cds_main.fieldbyname('ORDERNO').AsString;
|
||
fckno := cds_main.fieldbyname('ckno').AsString;
|
||
fkhname := cds_main.fieldbyname('tokhname').AsString;
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add(' UPDATE FHSQ_Sub SET FHPS=(SELECT COUNT(*) FROM CK_Cloth_CR A WHERE A.MainId=FHSQ_Sub.MainId and A.SubId=FHSQ_Sub.SubId and CRFlag=''<27><><EFBFBD><EFBFBD>'' and A.CKNo=FSID),');
|
||
sql.add(' FHQty=(SELECT SUM(JYLen) FROM CK_Cloth_CR A WHERE A.MainId=FHSQ_Sub.MainId and A.SubId=FHSQ_Sub.SubId and CRFlag=''<27><><EFBFBD><EFBFBD>'' and A.CKNo=FSID),');
|
||
sql.add(' FHKgQty=(SELECT SUM(JYGW) FROM CK_Cloth_CR A WHERE A.MainId=FHSQ_Sub.MainId and A.SubId=FHSQ_Sub.SubId and CRFlag=''<27><><EFBFBD><EFBFBD>'' and A.CKNo=FSID),');
|
||
sql.Add(' FHYQty=(SELECT SUM(JYYLen) FROM CK_Cloth_CR A WHERE A.MainId=FHSQ_Sub.MainId and A.SubId=FHSQ_Sub.SubId and CRFlag=''<27><><EFBFBD><EFBFBD>'' and A.CKNo=FSID) ');
|
||
sql.Add(' where FSID=' + quotedstr(fckno));
|
||
// SHOWMESSAGE(SQL.Text);
|
||
execsql;
|
||
end;
|
||
if CDS_Label.Locate('LMName', LBName, []) then
|
||
begin
|
||
//<2F><><EFBFBD>ǵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
|
||
if CDS_Label.fieldbyname('LMSql').AsString = 'P_MD_Bao5' then
|
||
begin
|
||
if CDS_Label.fieldbyname('LMNAME').AsString = 'ϸ<>뵥(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)' then
|
||
begin
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_Bao5 @Code=' + quotedstr(Trim(fckno)));
|
||
sql.Add(',@orderno=' + quotedstr(FORDERNO));
|
||
// SHOWMESSAGE(SQL.Text);
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_PRT);
|
||
SInitCDSData(ADOQueryPrint, CDS_PRT);
|
||
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_FZMD_CS2 @Code=' + quotedstr(Trim(fckno)));
|
||
sql.Add(',@khname=' + quotedstr(Trim(fkhname)));
|
||
sql.Add(',@ORDERNO=' + quotedstr(Trim(FORDERNO)));
|
||
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_HZ);
|
||
SInitCDSData(ADOQueryPrint, CDS_hz);
|
||
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(CDS_Label.fieldbyname('LMNAME').AsString) + '.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
Panel4.Visible := false;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
EXIT;
|
||
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('SELECT * FROM FHSQ_SUB A WHERE A.FSID=' + QuotedStr(Trim(fckno)));
|
||
SQL.Add('AND ZKHNAME=' + QuotedStr(Trim(fkhname)));
|
||
// SHOWMESSAGE(SQL.Text);
|
||
Open;
|
||
end;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQuery1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_Bao5 @Code=' + quotedstr(Trim(fckno)));
|
||
sql.Add(',@orderno=' + quotedstr(ADOQuery1.fieldbyname('scCONNO').AsString));
|
||
// SHOWMESSAGE(SQL.Text);
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_PRT);
|
||
SInitCDSData(ADOQueryPrint, CDS_PRT);
|
||
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_FZMD_CS2 @Code=' + quotedstr(Trim(fckno)));
|
||
sql.Add(',@khname=' + quotedstr(Trim(fkhname)));
|
||
sql.Add(',@ORDERNO=' + quotedstr(Trim(ADOQuery1.fieldbyname('scCONNO').AsString)));
|
||
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_HZ);
|
||
SInitCDSData(ADOQueryPrint, CDS_hz);
|
||
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(CDS_Label.fieldbyname('LMNAME').AsString) + '.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
Panel4.Visible := false;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
EXIT;
|
||
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
end;
|
||
end;
|
||
|
||
end
|
||
else if CDS_Label.fieldbyname('LMSql').AsString = 'P_MD_Bao30' then
|
||
begin
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('SELECT * FROM FHSQ_SUB A WHERE A.FSID=' + QuotedStr(Trim(fckno)));
|
||
SQL.Add('AND ZKHNAME=' + QuotedStr(Trim(fkhname)));
|
||
// SHOWMESSAGE(SQL.Text);
|
||
Open;
|
||
end;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQuery1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_Bao30 @Code=' + quotedstr(Trim(fckno)));
|
||
sql.Add(',@orderno=' + quotedstr(ADOQuery1.fieldbyname('scCONNO').AsString));
|
||
// SHOWMESSAGE(SQL.Text);
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_PRT);
|
||
SInitCDSData(ADOQueryPrint, CDS_PRT);
|
||
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_FZMD_CS2 @Code=' + quotedstr(Trim(fckno)));
|
||
sql.Add(',@khname=' + quotedstr(Trim(fkhname)));
|
||
sql.Add(',@ORDERNO=' + quotedstr(Trim(ADOQuery1.fieldbyname('scCONNO').AsString)));
|
||
// SHOWMESSAGE(SQL.Text);
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_HZ);
|
||
SInitCDSData(ADOQueryPrint, CDS_hz);
|
||
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(CDS_Label.fieldbyname('LMNAME').AsString) + '.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
Panel4.Visible := false;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
EXIT;
|
||
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
if CDS_Label.fieldbyname('LMSql').AsString = 'P_MD_FHMD' then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_FHMD @Code=' + quotedstr(Trim(fckno)));
|
||
// ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
end
|
||
else if CDS_Label.fieldbyname('LMSql').AsString = 'P_MD_FHMD2' then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_FHMD2 @Code=' + quotedstr(Trim(fckno)));
|
||
sql.Add(',@khname=' + quotedstr(Trim(fkhname)));
|
||
|
||
Open;
|
||
end;
|
||
end
|
||
else if CDS_Label.fieldbyname('LMSql').AsString = 'P_MD_MX_JUAN' then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_MX_JUAN @Code=' + quotedstr(Trim(fckno)));
|
||
Open;
|
||
end;
|
||
end
|
||
else if (CDS_Label.fieldbyname('LMSql').AsString = 'P_MD_Bao2') or (CDS_Label.fieldbyname('LMSql').AsString = 'P_MD_Bao30_2') then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql').AsString) + ' @Code=' + quotedstr(Trim(FORDERNO)));
|
||
sql.Add(',@ckno=' + QuotedStr(trim(fckno)));
|
||
// ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
end
|
||
else if (CDS_Label.fieldbyname('LMSql').AsString = 'P_MD_Bao_DDD') or (CDS_Label.fieldbyname('LMSql').AsString = 'P_MD_Bao_DDD2') then
|
||
begin
|
||
if cxPageControl1.ActivePageIndex = 0 then
|
||
begin
|
||
if CDS_2.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete TBSubID2 where DName=''' + Trim(DCode) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('SELECT * FROM TBSubID2 where 1=2 ');
|
||
open;
|
||
end;
|
||
|
||
CDS_2.DisableControls;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with CDS_2 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Fieldbyname('Ssel').AsBoolean then
|
||
begin
|
||
|
||
ADOQueryCmd.append;
|
||
ADOQueryCmd.fieldbyname('SubId').Value := Trim(CDS_2.fieldbyname('CKNO').AsString);
|
||
ADOQueryCmd.fieldbyname('ORDERNO').Value := Trim(CDS_2.fieldbyname('ORDERNO').AsString);
|
||
ADOQueryCmd.fieldbyname('Dname').Value := Trim(DCode);
|
||
ADOQueryCmd.post;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
end;
|
||
CDS_2.EnableControls;
|
||
if (CDS_Label.fieldbyname('LMSql').AsString = 'P_MD_Bao_DDD') then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_Bao_DDD @Code=' + quotedstr(Trim(DCode)));
|
||
// ShowMessage(sql.Text);
|
||
// ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_Bao_DDD2 @Code=' + quotedstr(Trim(DCode)));
|
||
// ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
end;
|
||
|
||
end
|
||
else if cxPageControl1.ActivePageIndex = 1 then
|
||
begin
|
||
|
||
Application.MessageBox('<27><><EFBFBD>ڻ<EFBFBD><DABB>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>뵥', '<27><>ʾ', 0);
|
||
Exit;
|
||
|
||
end;
|
||
// with ADOQueryPrint do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql').AsString) + ' @Code=' + quotedstr(Trim(FORDERNO)));
|
||
// sql.Add(',@ckno=' + QuotedStr(trim(fckno)));
|
||
//// ShowMessage(sql.Text);
|
||
// Open;
|
||
// end;
|
||
end
|
||
else if (CDS_Label.fieldbyname('LMSql').AsString = 'P_MD_BAO_HX') then
|
||
begin
|
||
if cxPageControl1.ActivePageIndex = 0 then
|
||
begin
|
||
if CDS_2.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete TBSubID2 where DName=''' + Trim(DCode) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('SELECT * FROM TBSubID2 where 1=2 ');
|
||
open;
|
||
end;
|
||
|
||
CDS_2.DisableControls;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with CDS_2 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Fieldbyname('Ssel').AsBoolean then
|
||
begin
|
||
|
||
ADOQueryCmd.append;
|
||
ADOQueryCmd.fieldbyname('SubId').Value := Trim(CDS_2.fieldbyname('P_HX').AsString);
|
||
ADOQueryCmd.fieldbyname('ORDERNO').Value := Trim(CDS_2.fieldbyname('ORDERNO').AsString);
|
||
ADOQueryCmd.fieldbyname('Dname').Value := Trim(DCode);
|
||
ADOQueryCmd.post;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
end;
|
||
CDS_2.EnableControls;
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_BAO_HX @Code=' + quotedstr(Trim(DCode)));
|
||
// ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
|
||
end
|
||
else if cxPageControl1.ActivePageIndex = 1 then
|
||
begin
|
||
|
||
Application.MessageBox('<27><><EFBFBD>ڻ<EFBFBD><DABB>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>뵥', '<27><>ʾ', 0);
|
||
Exit;
|
||
|
||
end;
|
||
end
|
||
else if (CDS_Label.fieldbyname('LMSql').AsString = 'P_MD_MX_JUAN_DDD') then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_MX_JUAN_DDD @Code=' + quotedstr(Trim(fckno)));
|
||
SQL.Add(',@ORDERNO=' + quotedstr(Trim(FORDERNO)));
|
||
// ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql').AsString) + ' @Code=' + quotedstr(Trim(FORDERNO)));
|
||
// ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_PRT);
|
||
SInitCDSData(ADOQueryPrint, CDS_PRT);
|
||
|
||
//<2F><><EFBFBD>ǵڶ<C7B5><DAB6><EFBFBD><EFBFBD><EFBFBD>
|
||
if trim(CDS_Label.fieldbyname('LMSql1').AsString) <> '' then
|
||
begin
|
||
if CDS_Label.fieldbyname('LMSql1').AsString = 'P_MD_FZMD_CS' then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_FZMD_CS @Code=' + quotedstr(Trim(fckno)));
|
||
sql.Add(',@khname=' + quotedstr(Trim(fkhname)));
|
||
// ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_hz);
|
||
SInitCDSData(ADOQueryPrint, CDS_hz);
|
||
end
|
||
else if CDS_Label.fieldbyname('LMSql1').AsString = 'P_MD_HZMD' then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql1').AsString) + ' @Code=' + quotedstr(Trim(fckno)));
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_hz);
|
||
SInitCDSData(ADOQueryPrint, CDS_hz);
|
||
end
|
||
else if CDS_Label.fieldbyname('LMSql1').AsString = 'P_MD_HZMD_dd' then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql1').AsString) + ' @Code=' + quotedstr(Trim(FORDERNO)));
|
||
sql.Add(',@ckno=' + QuotedStr(trim(fckno)));
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_hz);
|
||
SInitCDSData(ADOQueryPrint, CDS_hz);
|
||
end
|
||
else if CDS_Label.fieldbyname('LMSql1').AsString = 'P_MD_Bao_DDD_MX' then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_Bao_DDD_MX @Code=' + quotedstr(Trim(DCode)));
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_hz);
|
||
SInitCDSData(ADOQueryPrint, CDS_hz);
|
||
end
|
||
else if CDS_Label.fieldbyname('LMSql1').AsString = 'P_MD_Bao_DDD_MX2' then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_Bao_DDD_MX2 @Code=' + quotedstr(Trim(DCode)));
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_hz);
|
||
SInitCDSData(ADOQueryPrint, CDS_hz);
|
||
end
|
||
else if CDS_Label.fieldbyname('LMSql1').AsString = 'P_MD_Bao_HX_MX' then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_Bao_HX_MX @Code=' + quotedstr(Trim(DCode)));
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_hz);
|
||
SInitCDSData(ADOQueryPrint, CDS_hz);
|
||
end
|
||
else if CDS_Label.fieldbyname('LMSql1').AsString = 'P_MD_FZMD_DDD' then
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec P_MD_FZMD_DDD @Code=' + quotedstr(Trim(fckno)));
|
||
sql.Add(',@ORDERNO=' + quotedstr(Trim(FORDERNO)));
|
||
// ShowMessage(SQL.Text);
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_hz);
|
||
SInitCDSData(ADOQueryPrint, CDS_hz);
|
||
end
|
||
else
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql1').AsString) + ' @Code=' + quotedstr(Trim(FORDERNO)));
|
||
// ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryPrint, CDS_hz);
|
||
SInitCDSData(ADOQueryPrint, CDS_hz);
|
||
end;
|
||
|
||
end;
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + LBName + '.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
Panel4.Visible := false;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.BTLPClick(Sender: TObject);
|
||
begin
|
||
if CurrentPage > 1 then
|
||
CurrentPage := CurrentPage - 1;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.TCBNORChange(Sender: TObject);
|
||
begin
|
||
RecordsNumber := StrToInt(TCBNOR.Text);
|
||
CurrentPage := 1;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.CPTypeChange(Sender: TObject);
|
||
begin
|
||
CurrentPage := 1;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.CRTypeChange(Sender: TObject);
|
||
begin
|
||
CurrentPage := 1;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.cxPageControl1Change(Sender: TObject);
|
||
begin
|
||
CurrentPage := 1;
|
||
SetStatus();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.edtSMNOKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
Panel4.Visible := true;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
// frmSysLogHelp := TfrmSysLogHelp.create(self);
|
||
// with frmSysLogHelp do
|
||
// begin
|
||
// fModel := self.caption;
|
||
// // facction:='<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>ɾ<EFBFBD><C9BE>';
|
||
// showmodal;
|
||
// free;
|
||
// end;
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
PrintMD('Excel');
|
||
end;
|
||
|
||
procedure TfrmCKProductCPOutList.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmLbaelMap := TfrmLbaelMap.Create(Application);
|
||
with frmLbaelMap do
|
||
begin
|
||
FLMType := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>뵥';
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmLbaelMap.Free;
|
||
end;
|
||
GetLabel();
|
||
end;
|
||
|
||
end.
|
||
|