1028 lines
32 KiB
ObjectPascal
1028 lines
32 KiB
ObjectPascal
![]() |
unit U_CKProductBCPOutList;
|
|||
|
|
|||
|
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, RM_E_llPDF, cxCalendar;
|
|||
|
|
|||
|
type
|
|||
|
TfrmCKProductBCPOutList = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBExport: TToolButton;
|
|||
|
TBPrint: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
Label3: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
MPRTCodeName: TEdit;
|
|||
|
Label1: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
v2Column3: TcxGridDBColumn;
|
|||
|
v2Column5: TcxGridDBColumn;
|
|||
|
v2Column6: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
Label5: TLabel;
|
|||
|
orderNo: TEdit;
|
|||
|
Label6: TLabel;
|
|||
|
MJID: TEdit;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
Label8: TLabel;
|
|||
|
MPRTKZ: TEdit;
|
|||
|
Label9: TLabel;
|
|||
|
MPRTMF: TEdit;
|
|||
|
Label7: TLabel;
|
|||
|
CPType: TComboBox;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
Label10: TLabel;
|
|||
|
CkOrdNo: TEdit;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
TBCKCX: TToolButton;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
MovePanel2: TMovePanel;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
PRTColor: TComboBox;
|
|||
|
Label11: TLabel;
|
|||
|
AOrdDefStr1: TComboBox;
|
|||
|
ComboBox1: TComboBox;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
v1Column14: TcxGridDBColumn;
|
|||
|
v1Column15: TcxGridDBColumn;
|
|||
|
v1Column16: TcxGridDBColumn;
|
|||
|
MJXHM: TEdit;
|
|||
|
Label12: TLabel;
|
|||
|
CheckBox1: TCheckBox;
|
|||
|
Panel4: TPanel;
|
|||
|
Label13: TLabel;
|
|||
|
Panel10: TPanel;
|
|||
|
Image2: TImage;
|
|||
|
RichEdit1: TRichEdit;
|
|||
|
v1Column17: TcxGridDBColumn;
|
|||
|
v1Column18: TcxGridDBColumn;
|
|||
|
v1Column19: TcxGridDBColumn;
|
|||
|
v1Column20: TcxGridDBColumn;
|
|||
|
conNo: TEdit;
|
|||
|
Label15: TLabel;
|
|||
|
Label16: TLabel;
|
|||
|
KHConNo: TEdit;
|
|||
|
Label17: TLabel;
|
|||
|
apid: TEdit;
|
|||
|
v1Column21: TcxGridDBColumn;
|
|||
|
v1Column22: TcxGridDBColumn;
|
|||
|
v1Column23: TcxGridDBColumn;
|
|||
|
PRTKuanNO: TEdit;
|
|||
|
Label18: TLabel;
|
|||
|
begtime: TDateTimePicker;
|
|||
|
endTime: TDateTimePicker;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
RM2: TRMGridReport;
|
|||
|
v1rkplace: TcxGridDBColumn;
|
|||
|
kuwei: TEdit;
|
|||
|
Label19: TLabel;
|
|||
|
RMDBHZ: TRMDBDataSet;
|
|||
|
CDS_HZ: TClientDataSet;
|
|||
|
PRTHX: TEdit;
|
|||
|
Label20: TLabel;
|
|||
|
v1SOrddefstr1: TcxGridDBColumn;
|
|||
|
SOrddefstr1: TEdit;
|
|||
|
Label21: TLabel;
|
|||
|
v1Column24: TcxGridDBColumn;
|
|||
|
v1Column25: TcxGridDBColumn;
|
|||
|
RM3: TRMGridReport;
|
|||
|
v1Column26: TcxGridDBColumn;
|
|||
|
v1Column27: TcxGridDBColumn;
|
|||
|
Panel3: TPanel;
|
|||
|
Label22: TLabel;
|
|||
|
tdNo1: TEdit;
|
|||
|
Label23: TLabel;
|
|||
|
jzxNo1: TEdit;
|
|||
|
Button1: TButton;
|
|||
|
Button2: TButton;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
Label24: TLabel;
|
|||
|
Label25: TLabel;
|
|||
|
tdNo: TEdit;
|
|||
|
jzxNo: TEdit;
|
|||
|
CDS_MDMX: TClientDataSet;
|
|||
|
CDS_MDHJ: TClientDataSet;
|
|||
|
RMDBMDMX: TRMDBDataSet;
|
|||
|
RMDBMDHJ: TRMDBDataSet;
|
|||
|
Label14: TLabel;
|
|||
|
CRType: TComboBox;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
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 TBExportClick(Sender: TObject);
|
|||
|
procedure TBFindClick(Sender: TObject);
|
|||
|
procedure MPRTCodeNameChange(Sender: TObject);
|
|||
|
procedure TBPrintClick(Sender: TObject);
|
|||
|
procedure orderNoChange(Sender: TObject);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure TBCKCXClick(Sender: TObject);
|
|||
|
procedure orderNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure Tv1CellClick(Sender: TcxCustomGridTableView;
|
|||
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure PRTColorChange(Sender: TObject);
|
|||
|
procedure AOrdDefStr1Change(Sender: TObject);
|
|||
|
procedure CheckBox1Click(Sender: TObject);
|
|||
|
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 Image2Click(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure Button2Click(Sender: TObject);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
private
|
|||
|
FLeft,FTop:Integer;
|
|||
|
procedure InitGrid();
|
|||
|
function YSData(Order_Main10:TClientDataSet):Boolean;
|
|||
|
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmCKProductBCPOutList: TfrmCKProductBCPOutList;
|
|||
|
|
|||
|
implementation
|
|||
|
uses
|
|||
|
U_DataLink,U_Fun, U_JYMJIDPRINT;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmCKProductBCPOutList:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.FormClose(Sender: TObject;
|
|||
|
var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action:=caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
|
|||
|
EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp)
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select A.*,cast(A.baono as int) intbaono,B.OrderNo,B.conNO,B.MPRTCodeName,B.MPRTSpec,B.MprtkuanNo,C.PrtkuanNo,C.PRTColor,C.SOrddefstr1,C.SOrddefstr4,B.MPRTMF,B.MPRTKZ,D.MJXH,C.PRTPrice,C.PRTHX ');
|
|||
|
sql.Add(',C.SOrddefstr4,D.MJQty3,D.MJQty4');
|
|||
|
sql.Add(',khconNo=(select Top 1 KHConNo from JYOrderCon_Main JCM where JCM.ConNo=B.OrderNo)');
|
|||
|
sql.Add(',isnull(customerNoName,B.OrderNo) KHName');
|
|||
|
sql.Add(',D.mjstr4 as AOrdDefStr1,cast(D.MJXH as varchar) as MJXHM ');
|
|||
|
SQL.Add(',kuwei=(select TOP 1 rkplace from CK_BanCP_CR X where X.mjid=A.mjid and X.CRFlag=''<27><><EFBFBD><EFBFBD>'')');
|
|||
|
sql.add('from CK_BanCP_CR A ');
|
|||
|
Sql.add(' inner join JYOrder_Main B on B.MainId=A.MainId');
|
|||
|
Sql.add(' inner join JYOrder_Sub C on C.mainID=A.mainID and C.SubId=A.SubId');
|
|||
|
Sql.add(' inner join WFB_MJJY D on D.MJId=A.MJId');
|
|||
|
// sql.Add(' inner join JYOrder_Sub_AnPai E on A.APID=E.APID');
|
|||
|
sql.add(' where A.CRTime>='''+FormatDateTime('yyyy-MM-dd',BegDate.DateTime)+''' ');
|
|||
|
sql.Add(' and A.CRTime<'''+FormatDateTime('yyyy-MM-dd',enddate.DateTime+1)+''' ');
|
|||
|
SQL.Add(' and A.CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
Open;
|
|||
|
//ShowMessage(SQL.Text);
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
BegDate.SetFocus;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.ConNoMChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('<27>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
ReadCxGrid('<27>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
//InitGrid();
|
|||
|
if Trim(DParameters2)='<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
TBCKCX.Visible:=True;
|
|||
|
// ToolButton1.Visible:=true;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then exit;
|
|||
|
SelExportData(Tv1,ADOQueryMain,'');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.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 TfrmCKProductBCPOutList.MPRTCodeNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.TBPrintClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile,fPrintFile10,FMainID:String;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then Exit;
|
|||
|
IF trim(ComboBox1.Text)='' then exit;
|
|||
|
if CDS_Main.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 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
|
|||
|
IF trim(ComboBox1.Text)<>'<27><><EFBFBD><EFBFBD><EFBFBD>뵥' then
|
|||
|
begin
|
|||
|
IF FMainID='' then
|
|||
|
begin
|
|||
|
FMainID:=Trim(CDS_Main.fieldbyname('mainID').AsString);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
IF Trim(CDS_Main.fieldbyname('mainID').AsString)<>FMainID then
|
|||
|
begin
|
|||
|
application.MessageBox('ѡ<><D1A1><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>ͬһ<CDAC><D2BB>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
EnableControls;
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
ADOQueryCmd.append;
|
|||
|
ADOQueryCmd.fieldbyname('SubId').Value:=Trim(CDS_Main.fieldbyname('MJID').AsString);
|
|||
|
ADOQueryCmd.fieldbyname('Dname').Value:=Trim(DCode);
|
|||
|
ADOQueryCmd.post;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
|
|||
|
IF ((trim(ComboBox1.Text)='<27><>ϸ<EFBFBD>뵥')or(trim(ComboBox1.Text)='<27><><EFBFBD><EFBFBD><EFBFBD>뵥')) then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Print_CKBMD1 ''1'','+quotedstr(Trim(DCode)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_HZ);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_HZ);
|
|||
|
end;
|
|||
|
|
|||
|
IF trim(ComboBox1.Text)='<27><><EFBFBD><EFBFBD><EFBFBD>뵥' then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Print_CKBMD3 ''1'','+quotedstr(Trim(DCode)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_HZ);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_HZ);
|
|||
|
end;
|
|||
|
IF trim(ComboBox1.Text)='<27><><EFBFBD><EFBFBD><EFBFBD>뵥' then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Print_CKBMD11 ''2'','+quotedstr(Trim(DCode)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_MDHJ);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_MDHJ);
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Print_CKBMD11 ''1'','+quotedstr(Trim(DCode)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_MDMX);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_MDMX);
|
|||
|
end;
|
|||
|
|
|||
|
fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\'+Trim(ComboBox1.Text)+'.rmf' ;
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
IF trim(ComboBox1.Text)='<27><><EFBFBD><EFBFBD><EFBFBD>뵥' then
|
|||
|
begin
|
|||
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
RM2.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
RM3.LoadFromFile(fPrintFile);
|
|||
|
RM3.ShowReport;
|
|||
|
end;
|
|||
|
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+fPrintFile),'<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.orderNoChange(Sender: TObject);
|
|||
|
begin
|
|||
|
// if Length(orderNo.Text)<4 then Exit;
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main,True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main,False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.TBCKCXClick(Sender: TObject);
|
|||
|
var
|
|||
|
FFMainId,FPrice: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 ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete TBValueWhere where DName='+quotedstr(Trim(DName)));
|
|||
|
SQL.Add('and MainType='+quotedstr('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') );
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
while CDS_Main.Locate('SSel',True,[])=True do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' insert into TBValueWhere(DName,MainType,wsql1,wsql2) ');
|
|||
|
sql.Add('values('+quotedstr(Trim(DName))
|
|||
|
+','+quotedstr('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
|
|||
|
+','+quotedstr(Trim(CDS_Main.fieldbyname('MJID').AsString))
|
|||
|
+','+quotedstr(Trim(CDS_Main.fieldbyname('CRID').AsString))
|
|||
|
+')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select YFTypeID from YF_Money_CR A');
|
|||
|
sql.Add('where exists(select CKOrdNo from CK_BanCP_CR X where X.CRFlag=''<27><><EFBFBD><EFBFBD>'' and A.YFTypeID=X.CKOrdNo and X.subId=A.subId and X.MainId=A.MainId ');
|
|||
|
sql.Add(' and exists(select MJID from TBValueWhere Y where X.MJID=Y.wsql1 and Y.MainType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and Y.DName='+quotedstr(trim(DName)));
|
|||
|
sql.Add(' ))');
|
|||
|
open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryCmd.RecordCount>0 then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
MovePanel2.Visible:=False;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2>ܳ<EFBFBD><DCB3><EFBFBD>!','<27><>ʾ',0);
|
|||
|
InitGrid();
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update CK_BanCP_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRType='''',CRTime=NULL');
|
|||
|
sql.Add(',CRNote='''',CKOrdNo='''' from TBValueWhere A ');
|
|||
|
sql.Add(' where CK_BanCP_CR.CRID=A.wsql2 and A.MainType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and A.DName='+quotedstr(trim(DName)));
|
|||
|
sql.Add(' and CK_BanCP_CR.CRFlag=''<27><><EFBFBD><EFBFBD>''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPdate CK_BanCP_KC Set KCKgQty=(select A.KgQty from CK_BanCP_CR A where A.CRID=CK_BanCP_KC.CRID and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'') ');//ԭA.CRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' 2019-07-08 Roy<6F><79>
|
|||
|
sql.Add(',KCQty=(select A.Qty from CK_BanCP_CR A where A.CRID=CK_BanCP_KC.CRID and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'') '); //ԭA.CRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' 2019-07-08 Roy<6F><79>
|
|||
|
SQL.Add('FROM TBValueWhere A where CK_BanCp_KC.CRID=A.wsql2 and A.MainType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and A.DName='+quotedstr(trim(DName)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update WFB_MJJY Set MJStr2=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' FROM TBValueWhere A'); //'<27>ѳ<EFBFBD><D1B3><EFBFBD>'״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD>⣬<EFBFBD><E2A3AC><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD>һ<EFBFBD><D2BB>
|
|||
|
SQL.Add(' where WFB_MJJY.MJID=A.wsql1 and A.MainType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and A.DName='+quotedstr(trim(DName)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Update_Order_JD_ByOther @MainType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add(',@DName='+quotedstr(Trim(DName)));
|
|||
|
ExecSQL;
|
|||
|
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;
|
|||
|
end;
|
|||
|
function TfrmCKProductBCPOutList.YSData(Order_Main10:TClientDataSet):Boolean;
|
|||
|
var
|
|||
|
CRID,YFID,PriceUnit,OrderUnit,FComTaiTou,FromSubID:String;
|
|||
|
fprice,huilv:double;
|
|||
|
begin
|
|||
|
Result:=False;
|
|||
|
fprice:=0;
|
|||
|
with Order_Main10 do
|
|||
|
begin
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select Top 1 *,fPrice=dbo.F_Get_Order_Price(MainID,subID) from JYOrder_Sub Where subID='''+Trim(Order_Main10.fieldbyname('subID').AsString)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
IF not ADOQueryTemp.IsEmpty then
|
|||
|
begin
|
|||
|
PriceUnit:=Trim(ADOQueryTemp.fieldbyname('PriceUnit').AsString);
|
|||
|
OrderUnit:=Trim(ADOQueryTemp.fieldbyname('OrderUnit').AsString);
|
|||
|
fPrice:= ADOQueryTemp.fieldbyname('fPrice').AsFloat;
|
|||
|
huilv:= ADOQueryTemp.fieldbyname('huilv').AsFloat;
|
|||
|
end;
|
|||
|
IF huilv=0 then huilv:=1;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from YF_Money_KC where FactoryName='''+Trim(Order_Main10.fieldbyname('KHName').AsString)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
begin
|
|||
|
CRID:=ADOQueryTemp.fieldbyname('CRID').AsString;
|
|||
|
end else
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_CRID set CRID=CRID+1');
|
|||
|
sql.Add('select * from YF_Money_CRID ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
CRID:=ADOQueryCmd.fieldbyname('CRID').AsString;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from YF_Money_KC where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('CRID').Value:=StrToInt(CRID);
|
|||
|
FieldByName('FactoryName').Value:=Trim(Order_Main10.fieldbyname('KHName').AsString);
|
|||
|
FieldByName('ZdyStr1').Value:='Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from YF_Money_CR where FactoryName='''+Trim(Order_Main10.fieldbyname('KHName').AsString)+'''');
|
|||
|
sql.Add(' and mainID='''+Trim(Order_Main10.fieldbyname('mainID').AsString)+'''');
|
|||
|
sql.Add(' and subID='''+Trim(Order_Main10.fieldbyname('subID').AsString)+'''');
|
|||
|
sql.Add(' and CRTime='''+FormatDateTime('yyyy-MM-dd',Order_Main10.fieldbyname('CRTime').AsDateTime)+'''') ;
|
|||
|
sql.Add(' and YFName=''<27><><EFBFBD>۽<EFBFBD><DBBD><EFBFBD>'' ');
|
|||
|
// sql.Add(' and YFTypeId='''+Trim(Order_Main10.fieldbyname('subID').AsString)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd,YFID,'CS','YF_Money_CR',3,1)=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('ȡ<><C8A1>ƷӦ<C6B7><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('YFID').Value:=Trim(YFID);
|
|||
|
FieldByName('YFTypeId').Value:=Trim(Order_Main10.fieldbyname('mainID').AsString);
|
|||
|
FieldByName('CRID').Value:=StrToInt(CRID);
|
|||
|
FieldByName('Filler').Value:=Trim(DName);
|
|||
|
FieldByName('CRType').Value:='Ӧ<>տ<EFBFBD><D5BF>Ǽ<EFBFBD>';
|
|||
|
FieldByName('CRFlag').Value:='Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('QtyFlag').Value:=1;
|
|||
|
FieldByName('FactoryName').Value:=Trim(Order_Main10.fieldbyname('KHName').AsString);
|
|||
|
FieldByName('CRTime').Value:=Trim(FormatDateTime('yyyy-MM-dd',Order_Main10.fieldbyname('CRTime').AsDateTime));
|
|||
|
FieldByName('YFType').Value:='<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('Price').Value:=fprice;
|
|||
|
FieldByName('HuiLv').Value:=huilv;
|
|||
|
FieldByName('BZType').Value:=Trim(PriceUnit);
|
|||
|
FieldByName('QtyUnit').Value:=Trim(Order_Main10.fieldbyname('QtyUnit').AsString);
|
|||
|
FieldByName('ComTaiTou').Value:=Trim(FComTaiTou);
|
|||
|
FieldByName('YFName').Value:='<27><><EFBFBD>۽<EFBFBD><DBBD><EFBFBD>';
|
|||
|
FieldByName('MainId').Value:=Trim(Order_Main10.fieldbyname('Mainid').AsString);
|
|||
|
FieldByName('subID').Value:=Trim(Order_Main10.fieldbyname('subID').AsString);
|
|||
|
// FieldByName('OrderNO').Value:=Trim(Order_Main10.fieldbyname('OrderNO').AsString);
|
|||
|
// FieldByName('P_CodeName').Value:=Trim(Order_Main10.fieldbyname('MprtCodeName').AsString);
|
|||
|
// FieldByName('P_Spec').Value:=Trim(Order_Main10.fieldbyname('MprtSpec').AsString);
|
|||
|
FieldByName('status').Value:='0';
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
YFID:=Trim(ADOQueryTemp.fieldbyname('YFID').AsString);
|
|||
|
end;
|
|||
|
IF uppercase(OrderUnit)='KG' then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update YF_Money_CR Set Qty=(select isnull(Sum(B.MJQty4),0) from CK_BanCP_CR A,WFB_MJJY B where A.MJID=B.MJID and A.MainID=YF_Money_CR.MainID and A.subID=YF_Money_CR.subID and A.CRtime=YF_Money_CR.CRTime and A.CRType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'') ');
|
|||
|
sql.Add(',PS=(select isnull(count(A.mainID),0) from CK_BanCP_CR A where A.maiNID=YF_Money_CR.maiNID and A.subID=YF_Money_CR.subID and A.CRtime=YF_Money_CR.CRTime and A.CRType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'') ');
|
|||
|
sql.Add(' where YFID='''+Trim(YFID)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
IF (uppercase(OrderUnit)='Y') and (uppercase(Trim(Order_Main10.fieldbyname('QtyUnit').AsString))='M') then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update YF_Money_CR Set Qty=(select cast(isnull(Sum(A.Qty),0)/0.9144 as decimal(18,2)) from CK_BanCP_CR A where A.MainID=YF_Money_CR.MainID and A.subID=YF_Money_CR.subID and A.CRtime=YF_Money_CR.CRTime and A.CRType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'') ');
|
|||
|
sql.Add(',PS=(select isnull(count(A.mainID),0) from CK_BanCP_CR A where A.maiNID=YF_Money_CR.maiNID and A.subID=YF_Money_CR.subID and A.CRtime=YF_Money_CR.CRTime and A.CRType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'') ');
|
|||
|
sql.Add(' where YFID='''+Trim(YFID)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
IF (uppercase(OrderUnit)='M') and (uppercase(Trim(Order_Main10.fieldbyname('QtyUnit').AsString))='Y') then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update YF_Money_CR Set Qty=(select cast(isnull(Sum(A.Qty),0)*0.9144 as decimal(18,2)) from CK_BanCP_CR A where A.MainID=YF_Money_CR.MainID and A.subID=YF_Money_CR.subID and A.CRtime=YF_Money_CR.CRTime and A.CRType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'') ');
|
|||
|
sql.Add(',PS=(select isnull(count(A.mainID),0) from CK_BanCP_CR A where A.maiNID=YF_Money_CR.maiNID and A.subID=YF_Money_CR.subID and A.CRtime=YF_Money_CR.CRTime and A.CRType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'') ');
|
|||
|
sql.Add(' where YFID='''+Trim(YFID)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update YF_Money_CR Set Qty=(select isnull(Sum(A.Qty),0) from CK_BanCP_CR A where A.MainID=YF_Money_CR.MainID and A.subID=YF_Money_CR.subID and A.CRtime=YF_Money_CR.CRTime and A.CRType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'') ');
|
|||
|
sql.Add(',PS=(select isnull(count(A.mainID),0) from CK_BanCP_CR A where A.maiNID=YF_Money_CR.maiNID and A.subID=YF_Money_CR.subID and A.CRtime=YF_Money_CR.CRTime and A.CRType=''<27><><EFBFBD>۳<EFBFBD><DBB3><EFBFBD>'') ');
|
|||
|
sql.Add(' where YFID='''+Trim(YFID)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update YF_Money_CR Set Money=Price*Qty,BBMoney=Price*Qty*HuiLv');
|
|||
|
sql.Add(' where YFID='''+Trim(YFID)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from YF_Money_CR where YFId='''+Trim(YFID)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.FieldByName('Qty').Value=0 then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete from YF_Money_CR where YFID='''+Trim(YFID)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
//Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Result:=True;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.orderNoKeyPress(Sender: TObject;
|
|||
|
var Key: Char);
|
|||
|
begin
|
|||
|
if Key=#13 then
|
|||
|
begin
|
|||
|
if Length(Trim(orderNo.Text))<3 then Exit;
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select A.*,B.OrderNo,B.conNO,B.MPRTCodeName,B.MPRTSpec,B.MprtkuanNo,C.PrtkuanNo,C.PRTColor,C.SOrddefstr1,C.SOrddefstr4,B.MPRTMF,B.MPRTKZ,D.MJXH,C.PRTPrice,C.PRTHX ');
|
|||
|
sql.Add(',C.SOrddefstr4,D.MJQty3,D.MJQty4');
|
|||
|
sql.Add(',khconNo=(select Top 1 KHConNo from JYOrderCon_Main JCM where JCM.ConNo=B.OrderNo)');
|
|||
|
sql.Add(',isnull(customerNoName,B.OrderNo) KHName');
|
|||
|
sql.Add(',D.mjstr4 as AOrdDefStr1,cast(D.MJXH as varchar) as MJXHM ');
|
|||
|
sql.add('from CK_BanCP_CR A ');
|
|||
|
Sql.add(' inner join JYOrder_Main B on A.MainId=B.MainId');
|
|||
|
Sql.add(' inner join JYOrder_Sub C on A.SubId=C.SubId');
|
|||
|
Sql.add(' inner join WFB_MJJY D on A.MJId=D.MJId');
|
|||
|
sql.add('where B.OrderNo like '''+'%'+Trim(orderNo.Text)+'%'+'''');
|
|||
|
SQL.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
Open;
|
|||
|
//ShowMessage(SQL.Text);
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.Tv1CellClick(
|
|||
|
Sender: TcxCustomGridTableView;
|
|||
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty=False then
|
|||
|
begin
|
|||
|
InitOrderColor(Trim(CDS_Main.fieldbyname('MainId').AsString),PRTColor,ADOQueryTemp);
|
|||
|
InitBCGangNo(Trim(CDS_Main.fieldbyname('SubId').AsString),AOrdDefStr1,ADOQueryTemp);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.PRTColorChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
if CDS_Main.IsEmpty=False then
|
|||
|
begin
|
|||
|
//InitOrderColor(Trim(CDS_Main.fieldbyname('MainId').AsString),PRTColor,ADOQueryTemp);
|
|||
|
InitBCGangNo(Trim(CDS_Main.fieldbyname('SubId').AsString),AOrdDefStr1,ADOQueryTemp);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.AOrdDefStr1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.CheckBox1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main,CheckBox1.Checked);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.Tv1CellDblClick(
|
|||
|
Sender: TcxCustomGridTableView;
|
|||
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
Panel4.Visible:=true;
|
|||
|
Panel4.Left:=FLeft;
|
|||
|
Panel4.Top:=FTop+110;
|
|||
|
Panel10.Caption:=Trim(TV1.Controller.FocusedColumn.Caption);
|
|||
|
RichEdit1.Text:=CDS_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString;
|
|||
|
application.ProcessMessages;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.Tv1MouseUp(Sender: TObject;
|
|||
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
begin
|
|||
|
FLeft:=X;
|
|||
|
FTop:=Y;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.Image2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel4.Visible:=False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.ToolButton3Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: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;
|
|||
|
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;
|
|||
|
ADOqueryCmd.Connection.BeginTrans;
|
|||
|
try
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if FieldByName('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
ADOQueryCmd.append;
|
|||
|
ADOQueryCmd.fieldbyname('SubId').Value:=Trim(fieldbyname('MJID').AsString);
|
|||
|
ADOQueryCmd.fieldbyname('Dname').Value:=Trim(DCode);
|
|||
|
ADOQueryCmd.post;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOqueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
end;
|
|||
|
with ADOqueryPrint do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_Get_JYMJID_Main ');
|
|||
|
sql.Add(' @MJID='+quotedstr(''));
|
|||
|
sql.Add(',@flag=''0'' ');
|
|||
|
sql.Add(',@userID='+quotedstr(trim(DCode)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
|
|||
|
fPrintFile:=ExtractFilePath(Application.ExeName)+'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ.rmf';;
|
|||
|
if NOT FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+trim(fPrintFile)),'<27><>ʾ',MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
Rm2.LoadFromFile(fPrintFile);
|
|||
|
Rm2.ShowReport;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
IF CDS_Main.IsEmpty then exit;
|
|||
|
frmJYMJIDPRINT:=TfrmJYMJIDPRINT.create(self);
|
|||
|
with frmJYMJIDPRINT do
|
|||
|
begin
|
|||
|
fMJID:=trim(self.CDS_Main.fieldbyname('MJID').AsString);
|
|||
|
fflag:=1;
|
|||
|
show;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.Button2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel3.Visible:=false;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.Button1Click(Sender: TObject);
|
|||
|
var
|
|||
|
FFMainId,FPrice: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;
|
|||
|
MovePanel2.Visible:=True;
|
|||
|
MovePanel2.Refresh;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete TBValueWhere where DName='+quotedstr(Trim(DName)));
|
|||
|
SQL.Add('and MainType='+quotedstr('<27><EFBFBD><DEB8>ᵥ') );
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_Main.FieldByName('SSel').AsBoolean=True then
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('tdNo').Value:=trim(tdNo1.Text);
|
|||
|
FieldByName('jzxNo').Value:=trim(jzxNo1.Text);
|
|||
|
Post;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' insert into TBValueWhere(DName,MainType,Value1,Value2,wsql1,wsql2) ');
|
|||
|
sql.Add(' values( '+quotedstr(Trim(DName))
|
|||
|
+','+quotedstr('<27><EFBFBD><DEB8>ᵥ')
|
|||
|
+','+Quotedstr(trim(tdNo1.Text))
|
|||
|
+','+quotedstr(Trim(jzxNo1.Text))
|
|||
|
+','+quotedstr(Trim(CDS_Main.fieldbyname('CRID').AsString))
|
|||
|
+','+quotedstr('<27><><EFBFBD><EFBFBD>')
|
|||
|
+')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE CK_BanCP_CR SET ');
|
|||
|
sql.add('tdNo=A.Value1,jzxNo=A.Value2');
|
|||
|
sql.Add('FROM TBValueWhere A where CK_BanCP_CR.CRID=A.wsql1 and CK_BanCP_CR.CRFlag=A.wsql2 ');
|
|||
|
SQL.Add('and A.MainType=''<27><EFBFBD><DEB8>ᵥ'' and A.DName='+quotedstr(trim(DName)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
MovePanel2.Visible:=False;
|
|||
|
Application.MessageBox('<27><EFBFBD><DEB8><EFBFBD><EFBFBD>ݳɹ<DDB3><C9B9><EFBFBD>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
except
|
|||
|
MovePanel2.Visible:=False;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel3.Visible:=true;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|