D7wmguihua/桂华管理系统/U_CKProductBCPKCListSel10.pas
DESKTOP-E401PHE\Administrator b4b5840f18 1
2025-01-18 16:22:10 +08:00

814 lines
24 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_CKProductBCPKCListSel10;
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
TfrmCKProductBCPKCListsel10 = 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;
Tseldd: TToolButton;
packNo: TcxCurrencyEdit;
Label16: TLabel;
defstr2: TComboBox;
v2defstr2: 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 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);
procedure TselddClick(Sender: TObject);
private
FLeft,FTop:Integer;
fCodeName:string;
fColor:string;
fmainID:string;
procedure InitGrid();
procedure InitGridNull();
Procedure DoQuery();
function SaveData():Boolean;
{ Private declarations }
public
fkeyNo:string;
fType:integer;
{ Public declarations }
end;
var
frmCKProductBCPKCListsel10: TfrmCKProductBCPKCListsel10;
implementation
uses
U_DataLink,U_Fun, U_UserHelp, U_ProductOrderNewListSEl;
{$R *.dfm}
function TfrmCKProductBCPKCListsel10.SaveData():Boolean;
var
phID:string;
P_ID:integer;
begin
Result:=false;
IF fType=0 then
begin
if GetLSNo(ADOQueryTemp,fkeyNo,'PN','CK_BanCP_PH',4,1)=False then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end;
P_ID:=1;
ADOQueryCmd.Connection.BeginTrans;
try
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update CK_BanCP_KC SET kcstatus=null ');
sql.Add('from CK_BanCP_KC A ');
sql.Add('inner join CK_BanCP_PH B on B.CRID=A.crid and B.mjid=A.mjid ');
sql.Add('where P_NO='+quotedstr(trim(fkeyNo)));
execsql;
end;
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('delete from CK_BanCP_PH ');
sql.Add('where P_NO='+quotedstr(trim(fkeyNo)));
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,'PH','CK_BanCP_PH',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_PH ');
sql.Add('where P_NO='+quotedstr(trim(fkeyNo)));
open;
end;
ADOQueryCmd.Append;
ADOQueryCmd.FieldByName('phID').Value:=trim(phID);
ADOQueryCmd.FieldByName('p_No').Value:=trim(fkeyNo);
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('defstr2').Value:=trim(fieldbyname('defstr2').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_KC ');
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;
end;
ADOQueryCmd.Connection.CommitTrans;
IF fType=0 then fkeyNo:='';
Result:=true;
except
ADOQueryCmd.Connection.RollbackTrans;
end;
end;
procedure TfrmCKProductBCPKCListsel10.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'' ');
IF fType=0 then
sql.Add('where A.mainId='+quotedstr(trim(fmainID)))
else
sql.Add('where exists(select * from CK_BanCP_PH X where X.mainID=A.mainID and X.subID=A.subID and P_NO='''+trim(fkeyNO)+''')');
// 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 TfrmCKProductBCPKCListsel10.FormDestroy(Sender: TObject);
begin
frmCKProductBCPKCListsel10:=nil;
end;
procedure TfrmCKProductBCPKCListsel10.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmCKProductBCPKCListsel10.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 TfrmCKProductBCPKCListsel10.InitGrid();
begin
try
// ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
SQL.Add('exec P_View_CPKCMX_SEL');
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');
SQL.Add('@P_Codename='+quotedstr(trim(fkeyNO)));
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('2')));
Open;
end;
SCreateCDS20(ADOQueryMain,CDS_SubSel);
SInitCDSData20(ADOQueryMain,CDS_SubSel);
finally
// ADOQueryMain.EnableControls;
TBFind.Click;
end;
end;
procedure TfrmCKProductBCPKCListsel10.InitGridNull();
begin
try
ADOQueryTemp.DisableControls;
with ADOQueryTemp do
begin
Filtered:=False;
Close;
sql.Clear;
SQL.Add('exec P_View_CPKCMXNull');
Open;
end;
SCreateCDS20(ADOQueryTemp,CDS_SubSel);
SInitCDSData20(ADOQueryTemp,CDS_SubSel);
finally
ADOQueryTemp.EnableControls;
end;
end;
procedure TfrmCKProductBCPKCListsel10.TBRafreshClick(Sender: TObject);
begin
// BegDate.SetFocus;
MovePanel2.Visible:=True;
MovePanel2.Refresh;
DOquery();
MovePanel2.Visible:=False;
end;
procedure TfrmCKProductBCPKCListsel10.ConNoMChange(Sender: TObject);
begin
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
end;
end;
procedure TfrmCKProductBCPKCListsel10.TBCloseClick(Sender: TObject);
begin
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv11',Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv21',Tv2,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv31',Tv3,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
Close;
end;
procedure TfrmCKProductBCPKCListsel10.FormShow(Sender: TObject);
begin
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv11',Tv1,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv21',Tv2,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv31',Tv3,'<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
// InitGridNull();
// InitGrid();
IF Ftype=1 then Tseldd.Visible:=false;
Doquery();
end;
procedure TfrmCKProductBCPKCListsel10.TBExportClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then exit;
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',cxGrid2);
end;
procedure TfrmCKProductBCPKCListsel10.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 TfrmCKProductBCPKCListsel10.C_CodeNameChange(Sender: TObject);
begin
TBFind.Click;
end;
procedure TfrmCKProductBCPKCListsel10.Panel10MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
TWinControl(Panel4).Perform(WM_SYSCOMMAND,$F012,0);
end;
procedure TfrmCKProductBCPKCListsel10.Image2Click(Sender: TObject);
begin
Panel4.Visible:=False;
end;
procedure TfrmCKProductBCPKCListsel10.Tv1MouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
FLeft:=X;
FTop:=Y;
end;
procedure TfrmCKProductBCPKCListsel10.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 TfrmCKProductBCPKCListsel10.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 TfrmCKProductBCPKCListsel10.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 TfrmCKProductBCPKCListsel10.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 TfrmCKProductBCPKCListsel10.Button1Click(Sender: TObject);
var
i:integer;
begin
if CDS_Main.IsEmpty then Exit;
IF trim(packNo.Text)='' then
begin
application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
exit;
end;
IF trim(defstr2.Text)='' then
begin
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
exit;
end;
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.FieldByName('defstr2').Value:=trim(defstr2.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.FieldByName('defstr2').Value:=trim(defstr2.Text);
CDS_SubSel.Post;
CDS_Main.Delete;
end;
next;
end;
EnableControls;
First;
end;
CDS_SubSel.EnableControls;
end;
procedure TfrmCKProductBCPKCListsel10.PHYGBtnClick(Sender: TObject);
begin
frmUserHelp:=TfrmUserHelp.Create(self);
with frmUserHelp do
begin
if showmodal=1 then
begin
PHYG.Text:=trim(ADOQueryHelp.fieldbyname('userName').AsString);
end;
free;
end;
end;
procedure TfrmCKProductBCPKCListsel10.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 TfrmCKProductBCPKCListsel10.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 TfrmCKProductBCPKCListsel10.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;
procedure TfrmCKProductBCPKCListsel10.TselddClick(Sender: TObject);
begin
Order_Main.EmptyDataSet;
tv3.OnFocusedRecordChanged:=nil;
frmProductOrderNewListSEl:=TfrmProductOrderNewListSEl.create(self);
with frmProductOrderNewListSEl do
begin
if showmodal=1 then
begin
Order_Main.DisableControls;
Order_Main.First;
while not Order_Main.Eof do
begin
IF Order_Main.FieldByName('ssel').AsBoolean then
begin
with self.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(Order_Main.fieldbyname('MainID').AsString)));
sql.Add('and A.subID='+quotedstr(trim(Order_Main.fieldbyname('subID').AsString)));
open;
end;
self.Order_Main.Last;
SInitCDSData20(self.AdoqueryTemp,self.Order_Main);
end;
Order_Main.Next;
end;
Order_Main.EnableControls;
end;
free;
end;
tv3.OnFocusedRecordChanged:=Tv3FocusedRecordChanged;
Order_Main.First;
end;
end.