D7myYunxiang/云翔生产管理(MYSC.dll)/U_BPZdy_LRPB_M1.pas
DESKTOP-E401PHE\Administrator 1011cb7292 1
2025-01-20 13:04:03 +08:00

778 lines
21 KiB
ObjectPascal
Raw Permalink 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_BPZdy_LRPB_M1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, ToolWin, ComCtrls,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel,
cxClasses, cxControls, cxGridCustomView, cxGrid, DBClient, ADODB, ImgList,
StdCtrls, ExtCtrls, cxTextEdit, cxGridCustomPopupMenu, cxGridPopupMenu,
cxButtonEdit, BtnEdit, cxTL, cxMaskEdit, cxInplaceContainer, cxDBTL,
cxTLData, cxContainer, cxCurrencyEdit, cxCheckBox, cxSplitter;
type
TfrmBPZDY_LRPB_M1 = class(TForm)
ToolBar1: TToolBar;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
DataSource1: TDataSource;
ClientDataSet1: TClientDataSet;
TBClose: TToolButton;
ADOConnection1: TADOConnection;
ThreeImgList: TImageList;
DataSource2: TDataSource;
ML_GYS: TClientDataSet;
DataSource3: TDataSource;
ML_GX: TClientDataSet;
ADOQuery6: TADOQuery;
ADOQuery2: TADOQuery;
ADOQuery3: TADOQuery;
Panel4: TPanel;
Panel5: TPanel;
Label6: TLabel;
Label7: TLabel;
MXName: TEdit;
Label10: TLabel;
MBPGYSName: TEdit;
Button1: TButton;
DataSource4: TDataSource;
ADOQueryTree: TADOQuery;
Order_Tree: TClientDataSet;
Panel6: TPanel;
cxGrid1: TcxGrid;
TV1: TcxGridDBTableView;
V1BPCode: TcxGridDBColumn;
V1BPName: TcxGridDBColumn;
v1MBPGYSName: TcxGridDBColumn;
V1BPID: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
ToolBar2: TToolBar;
ToolButton1: TToolButton;
Panel7: TPanel;
cxDBTreeList1: TcxDBTreeList;
cxDBTreeList1cxDBTreeListColumn2: TcxDBTreeListColumn;
cxGridPopupMenu1: TcxGridPopupMenu;
cxGridPopupMenu2: TcxGridPopupMenu;
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
cxStyleRepository2: TcxStyleRepository;
cxStyle2: TcxStyle;
MXCode: TEdit;
Label13: TLabel;
MNo: TEdit;
V1MNo: TcxGridDBColumn;
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
BPNameM: TEdit;
BPCodeM: TEdit;
V1BPNote: TcxGridDBColumn;
Label14: TLabel;
BPNote: TEdit;
V1BPPrice: TcxGridDBColumn;
Label15: TLabel;
BPPrice: TEdit;
Label16: TLabel;
V1BPNameQC: TcxGridDBColumn;
Label3: TLabel;
BPNameQC: TEdit;
V1BPHXST: TcxGridDBColumn;
Label4: TLabel;
BPHXST: TEdit;
VIFSC: TcxGridDBColumn;
V1YHType: TcxGridDBColumn;
Label5: TLabel;
YHType: TEdit;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBSaveClick(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TV1CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
procedure BPNamehange(Sender: TObject);
procedure V1NotePropertiesEditValueChanged(Sender: TObject);
procedure V1HelpTypePropertiesEditValueChanged(Sender: TObject);
procedure v1note1PropertiesEditValueChanged(Sender: TObject);
procedure V1BPCodePropertiesEditValueChanged(Sender: TObject);
procedure V1BPNamePropertiesEditValueChanged(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure BPCodeMChange(Sender: TObject);
procedure Tv3CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
procedure Button1Click(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure MXCodeKeyPress(Sender: TObject; var Key: Char);
procedure CYNoKeyPress(Sender: TObject; var Key: Char);
procedure MNoKeyPress(Sender: TObject; var Key: Char);
procedure FormDestroy(Sender: TObject);
procedure BPPriceKeyPress(Sender: TObject; var Key: Char);
procedure BPNoteKeyPress(Sender: TObject; var Key: Char);
private
FBPID,FCPID,FCPNo,FCPName:string;
procedure InitGrid();
procedure SaveData();
procedure initTree();
{ Private declarations }
public
flag,flagname,snote,MainType,FGYName,Fint,canshu1:string;
fnote,fnote1,forderno,fZdyFlag,ViewFlag,fHelpType:Boolean;
PPSTE:integer;
{ Public declarations }
end;
var
frmBPZDY_LRPB_M1: TfrmBPZDY_LRPB_M1;
implementation
uses
U_DataLink,U_Fun10,U_BPZdy_SH, U_BPZdy_HXK,U_CPTypePB,U_FileUp_TPSH;
{$R *.dfm}
procedure TfrmBPZDY_LRPB_M1.initTree();
begin
with ADOQueryTree do
begin
Close;
SQL.Clear;
SQL.Add('select *');
sql.Add(', Case when isnull(CPNo,'''')<>'''' then RTrim(CPNo)+''/''+CPName else CPName end as CP ');
SQL.Add('from CP_TypePB_M order by CPlevel,CPOrder,CPName');
Open;
end;
SCreateCDS20(ADOQueryTree,Order_Tree);
SInitCDSData20(ADOQueryTree,Order_Tree);
cxDBTreeList1.Items[0].Expand(true);
end;
procedure TfrmBPZDY_LRPB_M1.SaveData();
var maxno:string;
begin
if FGYName<>'' then exit;
try
ADOQueryCmd.Connection.BeginTrans;
ClientDataSet1.DisableControls;
with ClientDataSet1 do
begin
First;
while not eof do
begin
if Trim(ClientDataSet1.FieldByName('BPID').AsString)='' then
begin
if GetLSNo(ADOQueryTemp,maxno,'BP','BP_ZDY_M',3,1)=False then
begin
ADOQueryCmd.Connection.RollbackTrans;
ClientDataSet1.EnableControls;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end
else
begin
maxno:=Trim(ClientDataSet1.fieldbyname('BPID').AsString);
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from BP_ZDY_M where BPID='''+Trim(maxno)+'''');
Open;
end;
if ADOQueryCmd.IsEmpty then
begin
ADOQueryCmd.Append;
end
else
begin
ADOQueryCmd.Edit;
end;
ADOQueryCmd.FieldByName('BPID').Value:=Trim(maxno);
SSetSaveDataCDSNew(ADOQueryCmd,Tv1,ClientDataSet1,'BP_ZDY_M',3);
ADOQueryCmd.FieldByName('BPType').Value:=flagName;
ADOQueryCmd.FieldByName('BPFlag').Value:=flag;
ADOQueryCmd.FieldByName('valid').Value:='Y';
ADOQueryCmd.Post;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.add('select * from BP_ZDY_M where BPCode='''+Trim(ClientDataSet1.fieldbyname('BPCode').AsString)+'''');
sql.Add(' and BPFlag='''+trim(flag)+'''');
Open;
end;
if ADOQueryTemp.IsEmpty=False then
begin
if ADOQueryTemp.RecordCount>1 then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add('delete BP_ZDY_M where BPID='''+Trim(ClientDataSet1.fieldbyname('BPID').AsString)+'''');
ExecSQL;
end;
ADOQueryCmd.Connection.RollbackTrans;
ClientDataSet1.EnableControls;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>','<27><>ʾ',0);
Exit;
end;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.add('select * from BP_ZDY_M where BPName='''+Trim(ClientDataSet1.fieldbyname('BPName').AsString)+'''');
sql.Add(' and BPFlag='''+trim(flag)+'''');
Open;
end;
if ADOQueryTemp.IsEmpty=False then
begin
if ADOQueryTemp.RecordCount>1 then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add('delete BP_ZDY_M where BPID='''+Trim(ClientDataSet1.fieldbyname('BPID').AsString)+'''');
ExecSQL;
end;
ADOQueryCmd.Connection.RollbackTrans;
ClientDataSet1.EnableControls;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>','<27><>ʾ',0);
Exit;
end;
end;
ClientDataSet1.Edit;
ClientDataSet1.FieldByName('BPID').Value:=Trim(maxno);
//ClientDataSet1.Post;
Next;
end;
ClientDataSet1.EnableControls;
end;
TV1.OptionsData.Editing:=false;
TV1.OptionsSelection.CellSelect:=false;
ADOQueryCmd.Connection.CommitTrans;
except;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
end;
end;
procedure TfrmBPZDY_LRPB_M1.FormCreate(Sender: TObject);
begin
try
//cxGrid1.Align:=alClient;
with ADOConnection1 do
begin
Connected:=false;
ConnectionString:=DConString;
//ConnectionString:='';
Connected:=true;
end;
except;
frmBPZDY_LRPB_M1.Free;
end;
canshu1:=Trim(DParameters1);
end;
procedure TfrmBPZDY_LRPB_M1.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
ToolBar1.SetFocus;
Action:=caFree;
end;
procedure TfrmBPZDY_LRPB_M1.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Close;
sql.Clear;
sql.Add(' exec P_Select_BP_M :Code,:PState,:CYType,:Stats ');
Parameters.ParamByName('Code').Value:='';
Parameters.ParamByName('PState').Value:=0;
Parameters.ParamByName('CYType').Value:=Trim(Order_Tree.fieldbyname('CPID').AsString);
Parameters.ParamByName('Stats').Value:='';
Open;
end;
SCreateCDS20(ADOQueryMain,ClientDataSet1);
SInitCDSData20(ADOQueryMain,ClientDataSet1);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmBPZDY_LRPB_M1.TBSaveClick(Sender: TObject);
var
maxno:string;
begin
if ClientDataSet1.IsEmpty then Exit;
Toolbar1.SetFocus;
if ClientDataSet1.Locate('BPCode',null,[]) then
begin
Application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if ClientDataSet1.Locate('BPCode','',[]) then
begin
Application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if ClientDataSet1.Locate('BPName',null,[]) then
begin
Application.MessageBox('<27><><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if ClientDataSet1.Locate('BPName','',[]) then
begin
Application.MessageBox('<27><><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
SaveData();
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
end;
procedure TfrmBPZDY_LRPB_M1.TBCloseClick(Sender: TObject);
begin
panel1.SetFocus;
WriteCxGrid('<27>Զ<EFBFBD><D4B6><EFBFBD>'+Trim(flag)+'1YX1',TV1,'<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Close;
end;
procedure TfrmBPZDY_LRPB_M1.FormShow(Sender: TObject);
begin
initTree();
InitGrid();
ReadCxGrid('<27>Զ<EFBFBD><D4B6><EFBFBD>'+Trim(flag)+'1YX1',TV1,'<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
if ViewFlag=True then
begin
ToolButton1.Visible:=true;
end;
if canshu1='<27><>ѯ' then
begin
ToolBar2.Visible:=false;
Button1.Visible:=false;
Panel4.Align:=alClient;
V1BPNote.Visible:=False;
V1BPPrice.Visible:=false;
Label15.Visible:=false;
BPPrice.Visible:=false;
Label14.Visible:=false;
BPNote.Visible:=false;
end
else
begin
ToolBar2.Visible:=true;
Button1.Visible:=true;
Panel4.Align:=alLeft;
V1BPNote.Visible:=true;
V1BPPrice.Visible:=true;
Label15.Visible:=true;
BPPrice.Visible:=true;
Label14.Visible:=true;
BPNote.Visible:=true;
end;
end;
procedure TfrmBPZDY_LRPB_M1.TV1CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
var i:integer;
begin
if ToolButton1.Visible=true then
begin
Fint:='1';
ModalResult:=1;
end else
begin
ToolBar1.SetFocus;
if ClientDataSet1.IsEmpty then exit;
MBPGYSName.Text:=Trim(ClientDataSet1.fieldbyname('MBPGYSName').AsString);
MNo.Text:=Trim(ClientDataSet1.fieldbyname('MNo').AsString);
YHType.Text:=Trim(ClientDataSet1.fieldbyname('YHType').AsString);
BPHXST.Text:=Trim(ClientDataSet1.fieldbyname('BPHXST').AsString);
MXCode.Text:=Trim(ClientDataSet1.FieldByName('MXCode').AsString);
MXName.Text:=Trim(ClientDataSet1.FieldByName('MXName').AsString);
BPNameQC.Text:=Trim(ClientDataSet1.FieldByName('BPNameQC').AsString);
BPPrice.Text:=Trim(ClientDataSet1.FieldByName('BPPrice').AsString);
BPNote.Text:=Trim(ClientDataSet1.FieldByName('BPNote').AsString);
FBPID:=Trim(ClientDataSet1.fieldbyname('BPID').AsString);
FCPID:=Trim(ClientDataSet1.fieldbyname('CPID').AsString);
FCPNo:=Trim(ClientDataSet1.fieldbyname('CPNo').AsString);
FCPName:=Trim(ClientDataSet1.fieldbyname('CPName').AsString);
Panel5.Visible:=True;
Button1.Caption:='<27>޸ı<DEB8><C4B1><EFBFBD>';
end;
end;
procedure TfrmBPZDY_LRPB_M1.BPNamehange(Sender: TObject);
var
fsj:String;
begin
if Trim(BPNameM.Text)<>'' then
begin
fsj:=' BPName like '''+'%'+Trim(BPNameM.Text)+'%'+'''';
end;
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain,fsj);
SCreateCDS20(ADOQueryMain,ClientDataSet1);
SInitCDSData20(ADOQueryMain,ClientDataSet1);
end;
end;
procedure TfrmBPZDY_LRPB_M1.V1NotePropertiesEditValueChanged(Sender: TObject);
var
mvalue:string;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
with ClientDataSet1 do
begin
Edit;
FieldByName('BPKZ').Value:=mvalue;
//Post;
end;
end;
procedure TfrmBPZDY_LRPB_M1.V1HelpTypePropertiesEditValueChanged(
Sender: TObject);
var
mvalue:string;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
with ClientDataSet1 do
begin
Edit;
FieldByName('BPWS').Value:=mvalue;
Post;
end;
{with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('Update KH_Zdy Set HelpType='''+Trim(mvalue)+'''');
sql.Add(' where ZdyNo='''+Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)+'''');
ExecSQL;
end;}
end;
procedure TfrmBPZDY_LRPB_M1.v1note1PropertiesEditValueChanged(Sender: TObject);
var
mvalue:string;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
with ClientDataSet1 do
begin
Edit;
FieldByName('BPMiDu').Value:=mvalue;
Post;
end;
end;
procedure TfrmBPZDY_LRPB_M1.V1BPCodePropertiesEditValueChanged(Sender: TObject);
var
mvalue:string;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
with ClientDataSet1 do
begin
Edit;
FieldByName('BPCode').Value:=mvalue;
end;
end;
procedure TfrmBPZDY_LRPB_M1.V1BPNamePropertiesEditValueChanged(Sender: TObject);
var
mvalue:string;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
with ClientDataSet1 do
begin
Edit;
FieldByName('BPName').Value:=mvalue;
end;
end;
procedure TfrmBPZDY_LRPB_M1.ToolButton4Click(Sender: TObject);
begin
ToolBar1.SetFocus;
if ClientDataSet1.IsEmpty then exit;
if ClientDataSet1.FieldByName('BPID').AsString='' then
begin
application.MessageBox('<27><EFBFBD><EBB1A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ','<27><>ʾ');
exit;
end;
with ML_GYS do
begin
Append;
post;
end;
end;
procedure TfrmBPZDY_LRPB_M1.BPCodeMChange(Sender: TObject);
var
fsj:String;
begin
if Trim(BPCodeM.Text)<>'' then
begin
fsj:=' BPCode like '''+'%'+Trim(BPCodeM.Text)+'%'+'''';
end;
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain,fsj);
SCreateCDS20(ADOQueryMain,ClientDataSet1);
SInitCDSData20(ADOQueryMain,ClientDataSet1);
end;
end;
procedure TfrmBPZDY_LRPB_M1.Tv3CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
var i:Integer;
begin
if ML_GX.IsEmpty then exit;
ML_GX.Delete;
i:=1;
ML_GX.DisableControls;
with ML_GX do
begin
first;
while not eof do
begin
Edit;
FieldByName('BPMiDu').Value:=i;
i:=i+1;
next;
end;
end;
ML_GX.EnableControls;
end;
procedure TfrmBPZDY_LRPB_M1.Button1Click(Sender: TObject);
var
maxno,FCPMiDu:string;
FInt:Integer;
FReal:Double;
begin
if Button1.Caption='<27>޸ı<DEB8><C4B1><EFBFBD>' then
begin
if Application.MessageBox(<><C8B7>Ҫ<EFBFBD>޸ı<DEB8><C4B1><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',1)=2 then exit;
end;
if Button1.Caption='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
if Label16.Caption='' then
begin
application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ');
exit;
end;
end;
if MXCode.Text='' then
begin
application.MessageBox('<27><><EFBFBD><EFBFBD><EBB2BB>Ϊ<EFBFBD><CEAA>','<27><>ʾ');
exit;
end;
if Length(MXCode.Text)>2 then
begin
application.MessageBox('<27><><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD><32><CEBB>','<27><>ʾ');
exit;
end;
if TryStrToInt(MXCode.Text,FInt)=False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
if Trim(BPPrice.Text)<>'' then
begin
if TryStrToFloat(BPPrice.Text,FReal)=False then
begin
Application.MessageBox('<27><><EFBFBD>۷Ƿ<DBB7><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
end;
{if Trim(MNo.Text)<>'' then
begin
Application.MessageBox('Ĥ<><C4A4><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
Exit;
end;}
if Trim(Button1.Caption)<>'<27>޸ı<DEB8><C4B1><EFBFBD>' then
begin
if Order_Tree.FieldByName('CPLevel').AsInteger=1 then
begin
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ');
exit;
end;
end;
try
ADOQueryCmd.Connection.BeginTrans;
if FBPID='' then
begin
if GetLSNo(ADOQueryTemp,FBPID,'BP','BP_ZDY_M',3,1)=False then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from BP_ZDY_M where BPID='''+Trim(FBPID)+'''');
Open;
end;
if ADOQueryCmd.IsEmpty then
begin
ADOQueryCmd.Append;
end
else
begin
ADOQueryCmd.Edit;
end;
ADOQueryCmd.FieldByName('BPID').Value:=Trim(FBPID);
RTSetsavedata(ADOQueryCmd,'BP_ZDY_M',panel5,2);
ADOQueryCmd.FieldByName('BPType').Value:=flagName;
ADOQueryCmd.FieldByName('BPFlag').Value:=flag;
ADOQueryCmd.FieldByName('valid').Value:='Y';
ADOQueryCmd.FieldByName('CPID').Value:=trim(FCPID);
ADOQueryCmd.FieldByName('CPNo').Value:=trim(FCPNo);
ADOQueryCmd.FieldByName('CPName').Value:=trim(FCPName);
if Trim(BPPrice.Text)<>'' then
ADOQueryCmd.FieldByName('BPPrice').Value:=BPPrice.Text
else
ADOQueryCmd.FieldByName('BPPrice').Value:=Null;
ADOQueryCmd.FieldByName('BPNote').Value:=Trim(BPNote.Text);
ADOQueryCmd.FieldByName('BPCode').Value:=trim(FCPNo)+trim(MXCode.Text);
ADOQueryCmd.FieldByName('BPName').Value:=trim(MXName.Text);
ADOQueryCmd.Post;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.add('select * from BP_ZDY_M where BPCode='''+Trim(trim(FCPNo)+trim(MXCode.Text))+'''');
sql.Add(' and BPFlag='''+trim(flag)+'''');
Open;
end;
if ADOQueryTemp.RecordCount>1 then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>','<27><>ʾ',0);
Exit;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.add('select * from BP_ZDY_M where BPName='''+Trim(trim(FCPName)+trim(MXName.Text))+'''');
sql.Add(' and BPHXST='''+Trim(ClientDataSet1.fieldbyname('BPHXST').AsString)+'''');
sql.Add(' and BPFlag='''+trim(flag)+'''');
Open;
end;
if ADOQueryTemp.RecordCount>1 then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><>Ϣ<EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>','<27><>ʾ',0);
Exit;
end;
with ClientDataSet1 do
begin
if Button1.Caption<>'<27>޸ı<DEB8><C4B1><EFBFBD>' then
Append
else
edit;
FieldByName('BPID').Value:=Trim(FBPID);
FieldByName('BPCode').Value:=trim(FCPNo)+Trim(MXCode.Text);
FieldByName('BPName').Value:=Trim(MXName.Text);
FieldByName('MBPGYSName').Value:=Trim(MBPGYSName.Text);
FieldByName('BPNameQC').Value:=Trim(BPNameQC.Text);
FieldByName('MNo').Value:=Trim(MNo.Text);
FieldByName('YHType').Value:=Trim(YHType.Text);
FieldByName('BPHXST').Value:=Trim(BPHXST.Text);
FieldByName('MXCode').Value:=Trim(MXCode.Text);
FieldByName('MXName').Value:=Trim(MXName.Text);
if Trim(BPPrice.Text)<>'' then
FieldByName('BPPrice').Value:=BPPrice.Text
else
FieldByName('BPPrice').Value:=Null;
FieldByName('BPNote').Value:=Trim(BPNote.Text);
post;
end;
{with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('UPdate ML_Manage Set MLCF='''+Trim(BPCF.Text)+''',MLJWMD='''+Trim(CPMiDu.Text)+'''');
SQL.Add(' where SUBSTRING(MLNO,2,LEN(MLNO)-1)='''+Trim(ClientDataSet1.fieldbyname('BPCode').AsString)+'''');
sql.Add(' and isnull(GYType,'''')=''<27>̽<EFBFBD>'' ');
sql.Add(' and isnull(MLType,'''')=''<27>̽<EFBFBD><CCBD><EFBFBD><EFBFBD><EFBFBD>''');
ExecSQL;
end;}
SClearData(Panel5,2);
FBPID:='';
Button1.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
Panel5.Visible:=false;
ADOQueryCmd.Connection.CommitTrans;
except;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
end;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>','<27><>ʾ');
end;
procedure TfrmBPZDY_LRPB_M1.ToolButton1Click(Sender: TObject);
begin
ToolBar1.SetFocus;
Fint:='1';
ModalResult:=1;
end;
procedure TfrmBPZDY_LRPB_M1.MXCodeKeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
begin
MXName.SetFocus;
end;
end;
procedure TfrmBPZDY_LRPB_M1.CYNoKeyPress(Sender: TObject; var Key: Char);
var CPID:string;
begin
end;
procedure TfrmBPZDY_LRPB_M1.MNoKeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
begin
BPPrice.SetFocus;
end;
end;
procedure TfrmBPZDY_LRPB_M1.FormDestroy(Sender: TObject);
begin
frmBPZDY_LRPB_M1:=nil;
end;
procedure TfrmBPZDY_LRPB_M1.BPPriceKeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
begin
BPNote.SetFocus;
end;
end;
procedure TfrmBPZDY_LRPB_M1.BPNoteKeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
begin
Button1.SetFocus;
end;
end;
end.