749 lines
22 KiB
ObjectPascal
749 lines
22 KiB
ObjectPascal
unit U_CKProductBCPKCListSel_Other;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||
cxDataStorage, cxEdit, DB, cxDBData, cxGridCustomTableView,
|
||
cxGridTableView, cxGridBandedTableView, cxGridDBBandedTableView,
|
||
cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGridDBTableView,
|
||
cxGrid, StdCtrls, ComCtrls, ExtCtrls, ToolWin, cxGridCustomPopupMenu,
|
||
cxGridPopupMenu, ADODB, DBClient, cxDropDownEdit, MovePanel, cxCheckBox,
|
||
cxSplitter, cxCalendar, BtnEdit, cxContainer, cxTextEdit, cxCurrencyEdit;
|
||
|
||
type
|
||
TfrmCKProductBCPKCListSel_Other = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
Label3: TLabel;
|
||
Label4: TLabel;
|
||
C_CodeName: TEdit;
|
||
C_Color: 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;
|
||
Label5: TLabel;
|
||
conNo: TEdit;
|
||
Label6: TLabel;
|
||
MJID: TEdit;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
Label8: TLabel;
|
||
KZ: TEdit;
|
||
Label9: TLabel;
|
||
MF: TEdit;
|
||
Label7: TLabel;
|
||
CPType: TComboBox;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
Panel4: TPanel;
|
||
Label11: TLabel;
|
||
Panel10: TPanel;
|
||
Image2: TImage;
|
||
RichEdit1: TRichEdit;
|
||
MovePanel2: TMovePanel;
|
||
ToolButton1: TToolButton;
|
||
v1KCRollNum: TcxGridDBColumn;
|
||
v1gangNO: TcxGridDBColumn;
|
||
v1C_Color: TcxGridDBColumn;
|
||
cxGrid1: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
cxGridDBColumn6: TcxGridDBColumn;
|
||
cxGridDBColumn7: TcxGridDBColumn;
|
||
cxGridDBColumn8: TcxGridDBColumn;
|
||
cxGridDBColumn9: TcxGridDBColumn;
|
||
cxGridDBColumn10: TcxGridDBColumn;
|
||
cxGridDBColumn11: TcxGridDBColumn;
|
||
cxGridDBColumn12: TcxGridDBColumn;
|
||
cxGridDBColumn13: TcxGridDBColumn;
|
||
cxGridDBColumn14: TcxGridDBColumn;
|
||
cxGridDBColumn15: TcxGridDBColumn;
|
||
cxGridDBColumn16: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
cxSplitter1: TcxSplitter;
|
||
CDS_SubSel: TClientDataSet;
|
||
DSSubSel: TDataSource;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
Label10: TLabel;
|
||
KCQtyStr: TEdit;
|
||
Label12: TLabel;
|
||
AOrdDefStr1: TEdit;
|
||
v1KCKW: TcxGridDBColumn;
|
||
Label13: TLabel;
|
||
KCKW: TEdit;
|
||
Panel2: TPanel;
|
||
Panel3: TPanel;
|
||
cxGrid3: TcxGrid;
|
||
Tv3: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
v1OrderNo: TcxGridDBColumn;
|
||
v1ConNo: TcxGridDBColumn;
|
||
v1OrdDefStr1: TcxGridDBColumn;
|
||
cxGridDBColumn17: TcxGridDBColumn;
|
||
v1OrdPerson1: TcxGridDBColumn;
|
||
v1JGFactoryName: TcxGridDBColumn;
|
||
v1PRTColor: TcxGridDBColumn;
|
||
v1OrdDate: TcxGridDBColumn;
|
||
v1DeliveryDate: TcxGridDBColumn;
|
||
v1CustomerNoName: TcxGridDBColumn;
|
||
v1MPRTCodeName: TcxGridDBColumn;
|
||
v1MPRTSpec: TcxGridDBColumn;
|
||
v1MPRTCF: TcxGridDBColumn;
|
||
v1MPRTMF: TcxGridDBColumn;
|
||
v1MPRTKZ: TcxGridDBColumn;
|
||
cxGridDBColumn18: TcxGridDBColumn;
|
||
v1PRTRollNum: TcxGridDBColumn;
|
||
v1PRTOrderQty: TcxGridDBColumn;
|
||
cxGridDBColumn19: TcxGridDBColumn;
|
||
cxGridDBColumn20: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
Order_Main: TClientDataSet;
|
||
DataSource2: TDataSource;
|
||
v2RollNum: TcxGridDBColumn;
|
||
v2Qty: TcxGridDBColumn;
|
||
cxGridPopupMenu3: TcxGridPopupMenu;
|
||
v1Ssel: TcxGridDBColumn;
|
||
Button1: TButton;
|
||
v3Column1: TcxGridDBColumn;
|
||
v3Column2: TcxGridDBColumn;
|
||
v3Column3: TcxGridDBColumn;
|
||
v3Column4: TcxGridDBColumn;
|
||
v3Column5: TcxGridDBColumn;
|
||
v3Column6: TcxGridDBColumn;
|
||
v3Column7: TcxGridDBColumn;
|
||
v3Column8: TcxGridDBColumn;
|
||
v3Column9: TcxGridDBColumn;
|
||
v3Column10: TcxGridDBColumn;
|
||
v3gangNum: TcxGridDBColumn;
|
||
Label14: TLabel;
|
||
v2Column2: TcxGridDBColumn;
|
||
Label15: TLabel;
|
||
PHYG: TBtnEditA;
|
||
CDS_Print: TClientDataSet;
|
||
CheckBox1: TCheckBox;
|
||
packNo: TcxCurrencyEdit;
|
||
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 C_CodeNameChange(Sender: TObject);
|
||
procedure Panel10MouseMove(Sender: TObject; Shift: TShiftState; X,
|
||
Y: Integer);
|
||
procedure Image2Click(Sender: TObject);
|
||
procedure Tv1MouseUp(Sender: TObject; Button: TMouseButton;
|
||
Shift: TShiftState; X, Y: Integer);
|
||
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
procedure Tv3FocusedRecordChanged(Sender: TcxCustomGridTableView;
|
||
APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord;
|
||
ANewItemRecordFocusingChanged: Boolean);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure PHYGBtnClick(Sender: TObject);
|
||
procedure Tv1CustomDrawIndicatorCell(Sender: TcxGridTableView;
|
||
ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo;
|
||
var ADone: Boolean);
|
||
procedure Tv2CustomDrawIndicatorCell(Sender: TcxGridTableView;
|
||
ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo;
|
||
var ADone: Boolean);
|
||
procedure CheckBox1Click(Sender: TObject);
|
||
private
|
||
FLeft,FTop:Integer;
|
||
procedure InitGrid();
|
||
// procedure InitGridNull();
|
||
Procedure DoQuery();
|
||
function SaveData():Boolean;
|
||
{ Private declarations }
|
||
public
|
||
fCodeName:string;
|
||
fColor:string;
|
||
fmainID:string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmCKProductBCPKCListSel_Other: TfrmCKProductBCPKCListSel_Other;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_Fun, U_UserHelp, U_ZDYHelp;
|
||
|
||
{$R *.dfm}
|
||
|
||
function TfrmCKProductBCPKCListSel_Other.SaveData():Boolean;
|
||
var
|
||
phID:string;
|
||
P_No:string;
|
||
P_ID:integer;
|
||
begin
|
||
Result:=false;
|
||
|
||
if GetLSNo(ADOQueryTemp,P_No,'PNT','CK_BanCP_PH1',4,1)=False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
P_ID:=1;
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
|
||
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update CK_BanCP_KC1 SET kcstatus=null ');
|
||
sql.Add('from CK_BanCP_KC1 A ');
|
||
sql.Add('inner join CK_BanCP_PH1 B on B.CRID=A.crid and B.mjid=A.mjid ');
|
||
sql.Add('where B.mainID='+quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
sql.Add('and B.subID='+quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
|
||
execsql;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('delete from CK_BanCP_PH1 ');
|
||
sql.Add('where mainID='+quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
sql.Add('and subID='+quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
|
||
execsql;
|
||
end;
|
||
|
||
with CDS_SubSel do
|
||
begin
|
||
DisableControls;
|
||
first;
|
||
while not eof do
|
||
begin
|
||
if fieldbyname('qty').AsFloat=0 then continue;
|
||
if GetLSNo(ADOQueryTemp,phID,'PT','CK_BanCP_PH1',4,1)=False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_BanCP_PH1 ');
|
||
sql.Add('where mainID='+quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
sql.Add('and subID='+quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
|
||
open;
|
||
end;
|
||
ADOQueryCmd.Append;
|
||
ADOQueryCmd.FieldByName('phID').Value:=trim(phID);
|
||
ADOQueryCmd.FieldByName('p_No').Value:=trim(p_No);
|
||
ADOQueryCmd.FieldByName('p_ID').Value:=P_ID;
|
||
ADOQueryCmd.FieldByName('conNo').Value:=trim(fieldbyname('conNo').AsString);
|
||
ADOQueryCmd.FieldByName('MainID').Value:=trim(Order_Main.fieldbyname('MainID').AsString);
|
||
ADOQueryCmd.FieldByName('SubID').Value:=trim(Order_Main.fieldbyname('SubID').AsString);
|
||
ADOQueryCmd.FieldByName('PMainID').Value:=trim(fieldbyname('MainID').AsString);
|
||
ADOQueryCmd.FieldByName('PSubID').Value:=trim(fieldbyname('SubID').AsString);
|
||
ADOQueryCmd.FieldByName('mjID').Value:=trim(fieldbyname('mjID').AsString);
|
||
ADOQueryCmd.FieldByName('CRID').Value:=trim(fieldbyname('CRID').AsString);
|
||
ADOQueryCmd.FieldByName('qtyunit').Value:=trim(fieldbyname('kcqtyunit').AsString);
|
||
|
||
ADOQueryCmd.FieldByName('packNo').Value:=trim(fieldbyname('packNo').AsString);
|
||
ADOQueryCmd.FieldByName('qty').Value:=fieldbyname('qty').AsFloat;
|
||
ADOQueryCmd.FieldByName('Rollnum').Value:=fieldbyname('Rollnum').AsFloat;
|
||
ADOQueryCmd.FieldByName('Filler').Value:=trim(DName);
|
||
ADOQueryCmd.FieldByName('FillTime').Value:=SGetServerDateTime(ADOQueryTemp);
|
||
ADOQueryCmd.FieldByName('BCGangNo').Value:=trim(fieldbyname('AOrdDefStr1').AsString);
|
||
ADOQueryCmd.FieldByName('PHYG').Value:=trim(PHYG.Text);
|
||
ADOQueryCmd.Post;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_BanCP_KC1 ');
|
||
sql.Add('where mjid='+quotedstr(trim(CDS_SubSel.fieldbyname('mjid').AsString)));
|
||
sql.Add('and CRID='+quotedstr(trim(CDS_SubSel.fieldbyname('CRID').AsString)));
|
||
open;
|
||
edit;
|
||
fieldbyname('kcstatus').Value:='1';
|
||
post;
|
||
end;
|
||
P_ID:=P_ID+1;
|
||
next;
|
||
end;
|
||
first;
|
||
EnableControls;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_sub ');
|
||
sql.Add('where mainID='+quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
sql.Add('and subID='+quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
|
||
open;
|
||
edit;
|
||
fieldbyname('substatus').Value:='2';
|
||
post;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Result:=true;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.DoQuery();
|
||
begin
|
||
// Order_Main.DisableControls;
|
||
try
|
||
with AdoqueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,B.* ');
|
||
sql.Add('from JYOrder_sub A ');
|
||
sql.Add('inner JOIN JYOrder_Main B on B.mainID=A.mainID and isnull(B.status,''0'')>''0'' ');
|
||
sql.Add('where A.mainId='+quotedstr(trim(fmainID)));
|
||
sql.Add('and isnull(A.substatus,''0'')<''3'' ');
|
||
open;
|
||
end;
|
||
SCreateCDS20(AdoqueryTemp,Order_Main);
|
||
SInitCDSData20(AdoqueryTemp,Order_Main);
|
||
finally
|
||
// Order_Main.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmCKProductBCPKCListSel_Other:=nil;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.FormClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.FormCreate(Sender: TObject);
|
||
begin
|
||
Panel3.Align:=alClient;
|
||
// cxGrid1.Height:= Panel3.Height div 2;
|
||
cxGrid2.Align:=alClient;
|
||
BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
|
||
EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
|
||
// TBRafresh.Click;
|
||
end;
|
||
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.InitGrid();
|
||
begin
|
||
try
|
||
// ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('exec P_View_CPKCMX_SEL_other');
|
||
SQL.Add('@P_Codename='+quotedstr(trim(fCodeName)));
|
||
SQL.Add(',@P_Color='+quotedstr(trim(fColor)));
|
||
SQL.Add(',@mainID='+quotedstr(trim('')));
|
||
SQL.Add(',@subID='+quotedstr(trim('')));
|
||
SQL.Add(',@Flag='+quotedstr(trim('0')));
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('exec P_View_CPKCMX_SEL_other');
|
||
SQL.Add('@P_Codename='+quotedstr(trim(fCodeName)));
|
||
SQL.Add(',@P_Color='+quotedstr(trim(fColor)));
|
||
SQL.Add(',@mainID='+quotedstr(trim(Order_Main.fieldbyname('MainID').AsString)));
|
||
SQL.Add(',@subID='+quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
|
||
SQL.Add(',@Flag='+quotedstr(trim('1')));
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_SubSel);
|
||
SInitCDSData20(ADOQueryMain,CDS_SubSel);
|
||
finally
|
||
// ADOQueryMain.EnableControls;
|
||
TBFind.Click;
|
||
end;
|
||
end;
|
||
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
// BegDate.SetFocus;
|
||
MovePanel2.Visible:=True;
|
||
MovePanel2.Refresh;
|
||
DOquery();
|
||
MovePanel2.Visible:=False;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.ConNoMChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv1',Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv2',Tv2,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv3',Tv3,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv1',Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv2',Tv2,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv3',Tv3,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
||
// InitGridNull();
|
||
// InitGrid();
|
||
Doquery();
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then exit;
|
||
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',cxGrid2);
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter10(CDS_Main,SGetFilters(Panel1,1,2));
|
||
//SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
//SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.C_CodeNameChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.Panel10MouseMove(Sender: TObject;
|
||
Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
ReleaseCapture;
|
||
TWinControl(Panel4).Perform(WM_SYSCOMMAND,$F012,0);
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.Image2Click(Sender: TObject);
|
||
begin
|
||
Panel4.Visible:=False;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.Tv1MouseUp(Sender: TObject;
|
||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
FLeft:=X;
|
||
FTop:=Y;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.Tv1CellDblClick(
|
||
Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
var
|
||
i:Integer;
|
||
begin
|
||
//if CDS_Sel.Locate('CYID',Trim(CDS_Main.fieldbyname('CYID').AsString),[])=False then
|
||
//begin
|
||
{ if CDS_Main.IsEmpty then Exit;
|
||
CDS_SubSel.Append;
|
||
for i:=0 to CDS_SubSel.FieldCount-1 do
|
||
begin
|
||
CDS_SubSel.Fields[i].Value:=CDS_Main.Fields[i].Value;
|
||
end;
|
||
CDS_SubSel.Post;
|
||
CDS_Main.Delete;
|
||
//end; }
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.ToolButton1Click(Sender: TObject);
|
||
var
|
||
phRollNum,phQty:double;
|
||
begin
|
||
if CDS_SubSel.IsEmpty then exit;
|
||
conNo.SetFocus;
|
||
with CDS_SubSel do
|
||
begin
|
||
DisableControls;
|
||
first;
|
||
while not eof do
|
||
begin
|
||
if (trim(fieldbyname('C_CodeName').AsString)<>trim(Order_Main.FieldByName('PRTCodeName').AsString))
|
||
or (uppercase(trim(fieldbyname('C_Color').AsString))<>uppercase(trim(Order_Main.FieldByName('PRTColor').AsString))) then
|
||
begin
|
||
application.MessageBox('<27><>Ʒ<EFBFBD><C6B7><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
EnableControls;
|
||
exit;
|
||
end;
|
||
next;
|
||
end;
|
||
first;
|
||
EnableControls;
|
||
end;
|
||
phRollNum:=0;
|
||
phQty:=0;
|
||
with CDS_SubSel do
|
||
begin
|
||
DisableControls;
|
||
first;
|
||
while not eof do
|
||
begin
|
||
phRollNum:=phRollNum+ CDS_SubSel.fieldbyname('RollNum').AsFloat;
|
||
phQty:=phQty+ CDS_SubSel.fieldbyname('Qty').AsFloat;
|
||
next;
|
||
end;
|
||
first;
|
||
EnableControls;
|
||
end;
|
||
|
||
IF Order_Main.FieldByName('PRTRollNum').AsFloat<>0 then
|
||
begin
|
||
if (phRollNum<>Order_Main.FieldByName('PRTRollNum').AsFloat) then
|
||
if Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD>ﵽ<EFBFBD><EFB5BD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',32+4)<>IDYES then Exit;
|
||
end
|
||
else
|
||
begin
|
||
if (phQty<>Order_Main.FieldByName('PRTOrderQty').AsFloat) then
|
||
if Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD>ﵽ<EFBFBD><EFB5BD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',32+4)<>IDYES then Exit;
|
||
end;
|
||
|
||
|
||
if SaveData() then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
Order_Main.Delete;
|
||
CDS_SubSel.EmptyDataSet;
|
||
// TBRafresh.Click;
|
||
end
|
||
else
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.Tv2CellDblClick(
|
||
Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
var
|
||
i:Integer;
|
||
begin
|
||
//if CDS_Sel.Locate('CYID',Trim(CDS_Main.fieldbyname('CYID').AsString),[])=False then
|
||
//begin
|
||
if CDS_SubSel.IsEmpty then Exit;
|
||
CDS_Main.Append;
|
||
for i:=0 to CDS_Main.FieldCount-1 do
|
||
begin
|
||
CDS_Main.Fields[i].Value:=CDS_SubSel.Fields[i].Value;
|
||
end;
|
||
CDS_Main.FieldByName('ssel').Value:=false;
|
||
CDS_Main.Post;
|
||
CDS_SubSel.Delete;
|
||
//end;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.Tv3FocusedRecordChanged(
|
||
Sender: TcxCustomGridTableView; APrevFocusedRecord,
|
||
AFocusedRecord: TcxCustomGridRecord;
|
||
ANewItemRecordFocusingChanged: Boolean);
|
||
begin
|
||
IF Order_Main.IsEmpty then
|
||
begin
|
||
fCodeName:='!##@';
|
||
fColor:='!##@';
|
||
end
|
||
else
|
||
begin
|
||
FCodeName:= trim(Order_Main.FieldByName('PRTCodeName').AsString);
|
||
fColor:= trim(Order_Main.FieldByName('PRTColor').AsString);
|
||
end;
|
||
initGrid();
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.Button1Click(Sender: TObject);
|
||
var
|
||
i:integer;
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
CDS_SubSel.DisableControls;
|
||
with CDS_Main do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if (CDS_Main.Locate('ssel',true,[]))
|
||
and not CDS_SubSel.Locate('CRID',CDS_Main.fieldbyname('CRID').AsInteger,[]) then
|
||
begin
|
||
CDS_SubSel.Append;
|
||
for i:=0 to CDS_SubSel.FieldCount-1 do
|
||
begin
|
||
CDS_SubSel.Fields[i].Value:=CDS_Main.Fields[i].Value;
|
||
end;
|
||
CDS_SubSel.FieldByName('packNo').Value:=trim(packNO.Text);
|
||
CDS_SubSel.Post;
|
||
CDS_Main.Delete;
|
||
end;
|
||
next;
|
||
end;
|
||
EnableControls;
|
||
First;
|
||
end;
|
||
with CDS_Main do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not eof do
|
||
begin
|
||
if (CDS_Main.Locate('ssel',true,[]))
|
||
and not CDS_SubSel.Locate('CRID',CDS_Main.fieldbyname('CRID').AsInteger,[]) then
|
||
begin
|
||
CDS_SubSel.Append;
|
||
for i:=0 to CDS_SubSel.FieldCount-1 do
|
||
begin
|
||
CDS_SubSel.Fields[i].Value:=CDS_Main.Fields[i].Value;
|
||
end;
|
||
CDS_SubSel.FieldByName('packNo').Value:=trim(packNO.Text);
|
||
CDS_SubSel.Post;
|
||
CDS_Main.Delete;
|
||
end;
|
||
next;
|
||
end;
|
||
EnableControls;
|
||
First;
|
||
end;
|
||
CDS_SubSel.EnableControls;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.PHYGBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='PHYGFLAG';
|
||
flagname:='<27><><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>';
|
||
if ShowModal=1 then
|
||
begin
|
||
PHYG.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.Tv1CustomDrawIndicatorCell(
|
||
Sender: TcxGridTableView; ACanvas: TcxCanvas;
|
||
AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
|
||
var
|
||
FValue: string;
|
||
FBounds: TRect;
|
||
begin
|
||
FBounds := AViewInfo.Bounds;
|
||
if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then
|
||
begin
|
||
ACanvas.FillRect(FBounds);
|
||
ACanvas.DrawComplexFrame(FBounds, clBtnHighlight, clBtnShadow, [bBottom, bLeft, bRight], 1);
|
||
FValue :=IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index+1);
|
||
InflateRect(FBounds, -1, -1) ;
|
||
ACanvas.Font.Color := clBlack;
|
||
ACanvas.Brush.Style := bsClear;
|
||
ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop);
|
||
ADone := True;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCKProductBCPKCListSel_Other.Tv2CustomDrawIndicatorCell(
|
||
Sender: TcxGridTableView; ACanvas: TcxCanvas;
|
||
AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
|
||
var
|
||
FValue: string;
|
||
FBounds: TRect;
|
||
begin
|
||
FBounds := AViewInfo.Bounds;
|
||
if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then
|
||
begin
|
||
ACanvas.FillRect(FBounds);
|
||
ACanvas.DrawComplexFrame(FBounds, clBtnHighlight, clBtnShadow, [bBottom, bLeft, bRight], 1);
|
||
FValue :=IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index+1);
|
||
InflateRect(FBounds, -1, -1) ;
|
||
ACanvas.Font.Color := clBlack;
|
||
ACanvas.Brush.Style := bsClear;
|
||
ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop);
|
||
ADone := True;
|
||
end;
|
||
end;
|
||
procedure TfrmCKProductBCPKCListSel_Other.CheckBox1Click(Sender: TObject);
|
||
begin
|
||
IF CDS_Main.IsEmpty then exit;
|
||
with CDS_Main do
|
||
begin
|
||
DisableControls;
|
||
first;
|
||
while not eof do
|
||
begin
|
||
edit;
|
||
fieldbyname('ssel').Value:=checkbox1.Checked;
|
||
post;
|
||
next;
|
||
end;
|
||
First;
|
||
EnableControls;
|
||
end;
|
||
end;
|
||
|
||
end.
|