1050 lines
33 KiB
ObjectPascal
1050 lines
33 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,
|
|||
|
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator;
|
|||
|
|
|||
|
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;
|
|||
|
DS_JuanPRT: TDataSource;
|
|||
|
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;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
Panel2: TPanel;
|
|||
|
Label14: TLabel;
|
|||
|
THMJID: TEdit;
|
|||
|
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;
|
|||
|
// RMllPDFExport1: TRMllPDFExport;
|
|||
|
v1rkplace: TcxGridDBColumn;
|
|||
|
PRTWSHX: TEdit;
|
|||
|
Label19: TLabel;
|
|||
|
RMDBHZ: TRMDBDataSet;
|
|||
|
CDS_HZ: TClientDataSet;
|
|||
|
RM3: TRMGridReport;
|
|||
|
PRTHX: TEdit;
|
|||
|
Label20: TLabel;
|
|||
|
v1SOrddefstr1: TcxGridDBColumn;
|
|||
|
QRCOLNO: TEdit;
|
|||
|
Label21: TLabel;
|
|||
|
v1Column24: TcxGridDBColumn;
|
|||
|
RMDBPRT: TRMDBDataSet;
|
|||
|
CDS_PRT: TClientDataSet;
|
|||
|
Label22: TLabel;
|
|||
|
KHName: TEdit;
|
|||
|
Label23: TLabel;
|
|||
|
FPNo: TEdit;
|
|||
|
v1Column25: TcxGridDBColumn;
|
|||
|
v1Column26: TcxGridDBColumn;
|
|||
|
Label24: TLabel;
|
|||
|
CRType: TComboBox;
|
|||
|
RMDBMain: TRMDBDataSet;
|
|||
|
CDS_PRT1: TClientDataSet;
|
|||
|
RMDBMain1: TRMDBDataSet;
|
|||
|
v1Column27: TcxGridDBColumn;
|
|||
|
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 Panel2DblClick(Sender: TObject);
|
|||
|
procedure THMJIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
private
|
|||
|
FLeft, FTop: Integer;
|
|||
|
canshu2: string;
|
|||
|
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, U_RTFun;
|
|||
|
|
|||
|
{$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 C.QRCOLNO,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,C.PRTWSHX ');
|
|||
|
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,cast(D.BaoNo as int) as BaoNoM,D.BaoID as BaoIDM ');
|
|||
|
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>'' ');
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
BegDate.SetFocus;
|
|||
|
MovePanel2.Visible := True;
|
|||
|
MovePanel2.Refresh;
|
|||
|
InitGrid();
|
|||
|
MovePanel2.Visible := False;
|
|||
|
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();
|
|||
|
canshu2 := Trim(DParameters2);
|
|||
|
if Trim(canshu2) = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
TBCKCX.Visible := True;
|
|||
|
// ToolButton1.Visible:=true;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
cptype.ItemIndex := 0;
|
|||
|
CPType.Enabled := False;
|
|||
|
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, FKHName, FFPNo: string;
|
|||
|
sqlStr: 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;
|
|||
|
|
|||
|
MovePanel2.Visible := True;
|
|||
|
MovePanel2.Refresh;
|
|||
|
try
|
|||
|
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;
|
|||
|
sqlStr := '';
|
|||
|
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 FMainID='' then
|
|||
|
begin
|
|||
|
FMainID:=Trim(CDS_Main.fieldbyname('mainID').AsString);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
IF Trim(CDS_Main.fieldbyname('mainID').AsString)<>FMainID then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
EnableControls;
|
|||
|
MovePanel2.Visible:=False;
|
|||
|
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);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end; }
|
|||
|
if FKHName = '' then
|
|||
|
begin
|
|||
|
FKHName := Trim(CDS_Main.fieldbyname('KHName').AsString);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if Trim(CDS_Main.fieldbyname('KHName').AsString) <> FKHName then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
EnableControls;
|
|||
|
MovePanel2.Visible := False;
|
|||
|
application.MessageBox('ѡ<><D1A1><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>ͬһ<CDAC><D2BB><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
sqlStr := sqlStr + 'insert into TBSubID(SubId,Dname) ';
|
|||
|
sqlStr := sqlStr + ' values( ';
|
|||
|
sqlStr := sqlStr + ' ''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + ''', ';
|
|||
|
sqlStr := sqlStr + ' ''' + Trim(DCode) + ''' ';
|
|||
|
sqlStr := sqlStr + ' ) ';
|
|||
|
// 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;
|
|||
|
MovePanel2.Visible := False;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(sqlStr);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
if (trim(ComboBox1.Text) = '0000ģ<30><C4A3>') or (trim(ComboBox1.Text) = '02ģ<32><C4A3>') or (trim(ComboBox1.Text) = 'BGģ<47><C4A3>') or (trim(ComboBox1.Text) = 'BT-PDģ<44><C4A3>') or (trim(ComboBox1.Text) = 'BT-PRT ģ<><C4A3>') or (trim(ComboBox1.Text) = '<27><><EFBFBD><EFBFBD>PKLģ<4C><C4A3>') then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Do_PrintMd_XS');
|
|||
|
sql.add('@DName=' + quotedstr(Trim(DCode)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_HZ);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_HZ);
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Do_PrintMd_HZ ');
|
|||
|
sql.add('@mainID=' + quotedstr(Trim('')));
|
|||
|
sql.add(',@DName=' + quotedstr(Trim(DCode)));
|
|||
|
sql.add(',@flag=''2'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_PRT);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_PRT);
|
|||
|
end;
|
|||
|
|
|||
|
if (trim(ComboBox1.Text) = '<27>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥') then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Do_PrintMd_HZ ');
|
|||
|
sql.add('@mainID=' + quotedstr(Trim('')));
|
|||
|
sql.add(',@DName=' + quotedstr(Trim(DCode)));
|
|||
|
sql.add(',@flag=''2'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_PRT);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_PRT);
|
|||
|
end;
|
|||
|
|
|||
|
if (trim(ComboBox1.Text) = 'KGSģ<53><C4A3>') or (trim(ComboBox1.Text) = 'MTSģ<53><C4A3>') or (trim(ComboBox1.Text) = 'KGS&MTSģ<53><C4A3>') then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Print_CKMDYDL ');
|
|||
|
sql.add('@DName=' + quotedstr(Trim(DCode)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_HZ);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_HZ);
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Do_PrintMd_HZ ');
|
|||
|
sql.add('@mainID=' + quotedstr(Trim('')));
|
|||
|
sql.add(',@DName=' + quotedstr(Trim(DCode)));
|
|||
|
sql.add(',@flag=''2'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_PRT);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_PRT);
|
|||
|
end;
|
|||
|
|
|||
|
if (trim(ComboBox1.Text) = 'PKL-KGSģ<53><C4A3>') or (trim(ComboBox1.Text) = 'PKL-MTSģ<53><C4A3>') or (trim(ComboBox1.Text) = 'PKL-KGS&MTSģ<53><C4A3>') then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Do_PrintMdDS20 ');
|
|||
|
sql.add('@mainID=' + quotedstr(Trim('')));
|
|||
|
sql.add(',@DName=' + quotedstr(Trim(DCode)));
|
|||
|
sql.add(',@flag=''0'' ');
|
|||
|
sql.add(',@CNum=''12'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_HZ);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_HZ);
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Do_PrintMd_HZ ');
|
|||
|
sql.add('@mainID=' + quotedstr(Trim('')));
|
|||
|
sql.add(',@DName=' + quotedstr(Trim(DCode)));
|
|||
|
sql.add(',@flag=''1'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_PRT);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_PRT);
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Do_PrintMd_HZTJ ');
|
|||
|
sql.add('@DName=' + quotedstr(Trim(DCode)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_PRT1);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_PRT1);
|
|||
|
|
|||
|
finally
|
|||
|
MovePanel2.Visible := False;
|
|||
|
end;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ComboBox1.Text) + '.rmf';
|
|||
|
ExportFtErpFile(Trim(ComboBox1.Text) + '.rmf', ADOQueryCmd);
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RM3.LoadFromFile(fPrintFile);
|
|||
|
RM3.ShowReport;
|
|||
|
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
|
|||
|
// SelOKNoFilter(TV1, True);
|
|||
|
SelOKNo(CDS_Main, True)
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
// SelOKNoFilter(TV1, False);
|
|||
|
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 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_BanCP_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRType='''',CRTime=NULL,CRNote='''',CKOrdNo='''',CYNO=null ');
|
|||
|
sql.Add(' where MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''');
|
|||
|
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
|
|||
|
|
|||
|
sql.Add(' UPdate CK_BanCP_KC Set KCKgQty=(select KgQty from CK_BanCP_CR A where A.CRID=CK_BanCP_KC.CRID and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'') ');
|
|||
|
sql.Add(',KCQty=(select Qty from CK_BanCP_CR A where A.CRID=CK_BanCP_KC.CRID and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'') ');
|
|||
|
SQL.Add(' where MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''');
|
|||
|
sql.Add(' Update WFB_MJJY Set MJStr2=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' where MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + ''' ');
|
|||
|
|
|||
|
sql.Add(' Update CK_BanCP_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRType='''',CRTime=NULL,RKOrdId='''',RKStage='''' ');
|
|||
|
sql.Add(' where MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''');
|
|||
|
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
|
|||
|
SQL.Add(' and RKStage=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
|
|||
|
sql.Add(' Update WFB_MJJY Set MJStr2=''δ<><CEB4><EFBFBD><EFBFBD>'' where MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + ''' ');
|
|||
|
sql.Add(' and exists(select MJID from CK_BanCP_CR X where X.MJID=WFB_MJJY.MJID and X.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and MJStr2<>''δ<><CEB4><EFBFBD><EFBFBD>'')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
{ if YSData(CDS_Main)=False then
|
|||
|
begin
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
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;
|
|||
|
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(OrderUnit);
|
|||
|
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
|
|||
|
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 C.QRCOLNO,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,PRTWSHX ');
|
|||
|
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;
|
|||
|
TBFind.Click;
|
|||
|
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
|
|||
|
// SelOKNoFilter(TV1, 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.Panel2DblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel2.Visible := false;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.THMJIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
if Trim(THMJID.Text) = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>벻<EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CK_BanCP_CR A ');
|
|||
|
sql.Add('where MJID=' + quotedstr(trim(THMJID.Text)));
|
|||
|
sql.Add('and CRflag=''<27><><EFBFBD><EFBFBD>''');
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox('<27>˾<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update CK_BanCP_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRType='''',CRTime=NULL,CRNote='''',CKOrdNo='''' ');
|
|||
|
sql.Add(' where MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''');
|
|||
|
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
|
|||
|
|
|||
|
sql.Add('UPdate CK_BanCP_KC Set KCKgQty=(select KgQty from CK_BanCP_CR A where A.CRID=CK_BanCP_KC.CRID and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'') ');
|
|||
|
sql.Add(',KCQty=(select Qty from CK_BanCP_CR A where A.CRID=CK_BanCP_KC.CRID and A.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'') ');
|
|||
|
SQL.Add(' where MJID=' + CDS_Main.fieldbyname('MJID').AsString);
|
|||
|
sql.Add('Update WFB_MJJY Set MJStr2=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' where MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''');
|
|||
|
|
|||
|
sql.Add('Update CK_BanCP_CR Set CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',CRType='''',CRTime=NULL,RKOrdId='''',RKStage='''' ');
|
|||
|
sql.Add(' where MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + '''');
|
|||
|
sql.Add(' and CRFlag=''<27><><EFBFBD><EFBFBD>''');
|
|||
|
SQL.Add(' and RKStage=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
|
|||
|
sql.Add('Update WFB_MJJY Set MJStr2=''δ<><CEB4><EFBFBD><EFBFBD>'' where MJID=''' + Trim(CDS_Main.fieldbyname('MJID').AsString) + ''' ');
|
|||
|
sql.Add(' and exists(select MJID from CK_BanCP_CR X where X.MJID=WFB_MJJY.MJID and X.CRFlag=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and MJStr2<>''δ<><CEB4><EFBFBD><EFBFBD>'')');
|
|||
|
|
|||
|
// sql.Add('delete CK_BanCP_CR where BCID='+quotedstr(ADOQueryTemp.fieldbyname('BCID').AsString));
|
|||
|
// sql.Add('UPdate CK_BanCP_KC Set KCKgQty=(select KgQty from CK_BanCP_CR A where A.CRID=CK_BanCP_KC.CRID and A.CRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'') ');
|
|||
|
// sql.Add(',KCQty=(select Qty from CK_BanCP_CR A where A.CRID=CK_BanCP_KC.CRID and A.CRType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'') ');
|
|||
|
// SQL.Add(' where CRID='+quotedstr(ADOQueryTemp.fieldbyname('CRID').AsString));
|
|||
|
// sql.Add('Update WFB_MJJY Set MJStr2=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' where MJID='+quotedstr(ADOQueryTemp.fieldbyname('MJID').AsString));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
if CDS_Main.Locate('BCID', trim(ADOQueryTemp.fieldbyname('BCID').AsString), []) then
|
|||
|
CDS_Main.Delete;
|
|||
|
THMJID.Text := '';
|
|||
|
THMJID.SetFocus;
|
|||
|
Exit;
|
|||
|
except
|
|||
|
THMJID.Text := '';
|
|||
|
THMJID.SetFocus;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCKProductBCPOutList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel2.Visible := true;
|
|||
|
THMJID.Text := '';
|
|||
|
THMJID.SetFocus;
|
|||
|
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;
|
|||
|
|
|||
|
end.
|
|||
|
|