615 lines
19 KiB
ObjectPascal
615 lines
19 KiB
ObjectPascal
|
|
unit U_CPDBAO;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, strutils, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, StdCtrls, cxContainer, cxTextEdit, cxCurrencyEdit, BtnEdit, ExtCtrls, ComCtrls, ToolWin, DBClient, ADODB, MovePanel, Buttons, Menus, cxLookAndFeelPainters, cxButtons, RM_Common, RM_Class, RM_GridReport,
|
|||
|
|
RM_System, RM_Dataset, cxCheckBox, MMSystem, cxLookAndFeels, cxNavigator;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmCPDBao = class(TForm)
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
PHYG: TBtnEditA;
|
|||
|
|
defstr2: TComboBox;
|
|||
|
|
Label16: TLabel;
|
|||
|
|
Label15: TLabel;
|
|||
|
|
Label14: TLabel;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
CDSMJID: TClientDataSet;
|
|||
|
|
DataSource2: TDataSource;
|
|||
|
|
SmNO: TEdit;
|
|||
|
|
ADOQueryTmp: TADOQuery;
|
|||
|
|
kcKw: TBtnEditA;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
|
cxStyle1: TcxStyle;
|
|||
|
|
cxStyle2: TcxStyle;
|
|||
|
|
cxStyle_gridRow: TcxStyle;
|
|||
|
|
cxStyle_gridFoot: TcxStyle;
|
|||
|
|
cxStyle_gridHead: TcxStyle;
|
|||
|
|
cxStyle_gridGroupBox: TcxStyle;
|
|||
|
|
cxStyle_yellow: TcxStyle;
|
|||
|
|
cxStyle_Red: TcxStyle;
|
|||
|
|
cxStyle_fontBlack: TcxStyle;
|
|||
|
|
cxStyle_fontclFuchsia: TcxStyle;
|
|||
|
|
cxStyle_fontclPurple: TcxStyle;
|
|||
|
|
cxStyle_fontclGreen: TcxStyle;
|
|||
|
|
cxStyle_fontclBlue: TcxStyle;
|
|||
|
|
cxStyle_fontclTeal: TcxStyle;
|
|||
|
|
cxStyle_fontclOlive: TcxStyle;
|
|||
|
|
ADOQuery1: TADOQuery;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
ADOQueryTm: TADOQuery;
|
|||
|
|
DSTm: TDataSource;
|
|||
|
|
BaoID: TEdit;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
FileName: TcxButton;
|
|||
|
|
RMDB_Main: TRMDBDataSet;
|
|||
|
|
RM2: TRMGridReport;
|
|||
|
|
cxButton1: TcxButton;
|
|||
|
|
ADOQueryPrint: TADOQuery;
|
|||
|
|
CDSTM: TClientDataSet;
|
|||
|
|
cxButton2: TcxButton;
|
|||
|
|
CDSSEL: TClientDataSet;
|
|||
|
|
DSSEL: TDataSource;
|
|||
|
|
check_Fbz: TCheckBox;
|
|||
|
|
Fbq: TBtnEditA;
|
|||
|
|
ComboBox2: TComboBox;
|
|||
|
|
BaoBq: TBtnEditA;
|
|||
|
|
DBCS: TEdit;
|
|||
|
|
Panel2: TPanel;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
TV2: TcxGridDBTableView;
|
|||
|
|
cxGridDBMLCodeName: TcxGridDBColumn;
|
|||
|
|
cxGridDBJYColor: TcxGridDBColumn;
|
|||
|
|
VJYColHX: TcxGridDBColumn;
|
|||
|
|
V2CGangNo: TcxGridDBColumn;
|
|||
|
|
V2BaoNo: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn5: TcxGridDBColumn;
|
|||
|
|
cxGridDBJYLen: TcxGridDBColumn;
|
|||
|
|
V2CJYKG: TcxGridDBColumn;
|
|||
|
|
V2ColJYJZ: TcxGridDBColumn;
|
|||
|
|
V2SOMLColorNo: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
TV1: TcxGridDBTableView;
|
|||
|
|
cxJYID: TcxGridDBColumn;
|
|||
|
|
cxJYNo: TcxGridDBColumn;
|
|||
|
|
cxMLCodeName: TcxGridDBColumn;
|
|||
|
|
cJYColor: TcxGridDBColumn;
|
|||
|
|
cxJYColHX: TcxGridDBColumn;
|
|||
|
|
cxGangNo: TcxGridDBColumn;
|
|||
|
|
cxJYLen: TcxGridDBColumn;
|
|||
|
|
cxJYKG: TcxGridDBColumn;
|
|||
|
|
cJYJZ: TcxGridDBColumn;
|
|||
|
|
cxGridDBMLColorNo: TcxGridDBColumn;
|
|||
|
|
cxGridLevel2: TcxGridLevel;
|
|||
|
|
edtFenShu: TEdit;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
cxButton3: TcxButton;
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure SmNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure kcKwBtnClick(Sender: TObject);
|
|||
|
|
procedure baoNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure SpeedButton1Click(Sender: TObject);
|
|||
|
|
procedure SpeedButton12Click(Sender: TObject);
|
|||
|
|
procedure FileNameClick(Sender: TObject);
|
|||
|
|
procedure cxButton1Click(Sender: TObject);
|
|||
|
|
procedure BaoBqBtnClick(Sender: TObject);
|
|||
|
|
procedure TV1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
procedure TV2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure cxButton3Click(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
Rolls: integer;
|
|||
|
|
FCXDB: string;
|
|||
|
|
procedure InitGrid();
|
|||
|
|
procedure InitMJID();
|
|||
|
|
function SaveRK(): Boolean;
|
|||
|
|
procedure QueryRk();
|
|||
|
|
procedure QueryTM();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmCPDBao: TfrmCPDBao;
|
|||
|
|
newh: hwnd;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_Fun, U_ZDYHelp;
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.QueryTm();
|
|||
|
|
begin
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.QueryRk();
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmCPDBao.SaveRK(): Boolean;
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.InitGrid();
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.InitMJID();
|
|||
|
|
begin
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
SQL.Add('select A.*,B.*,C.MLCodeName,C.MLOrderNo from JTJY_New A ');
|
|||
|
|
sql.add('inner join ML_OrderSubidNew B on B.NewSubid=A.NewSubid ');
|
|||
|
|
sql.add('inner join ML_OrderMainNew C on C.NewMLID=A.NewMLID ');
|
|||
|
|
sql.Add('where A.JYID=' + quotedstr(trim(SmNO.Text)));
|
|||
|
|
Open;
|
|||
|
|
if not IsEmpty then
|
|||
|
|
begin
|
|||
|
|
with CDSMJID do
|
|||
|
|
begin
|
|||
|
|
CDSMJID.Append;
|
|||
|
|
CDSMJID.FieldByName('JYID').Value := trim(ADOQueryMain.Fieldbyname('JYID').AsString);
|
|||
|
|
CDSMJID.FieldByName('JYNo').Value := trim(ADOQueryMain.Fieldbyname('JYNo').AsString);
|
|||
|
|
CDSMJID.FieldByName('MLCodeName').Value := trim(ADOQueryMain.Fieldbyname('MLCodeName').AsString);
|
|||
|
|
CDSMJID.FieldByName('JYColor').Value := trim(ADOQueryMain.Fieldbyname('JYColor').AsString);
|
|||
|
|
CDSMJID.FieldByName('JYColHX').Value := trim(ADOQueryMain.Fieldbyname('JYColHX').AsString);
|
|||
|
|
CDSMJID.FieldByName('MLColorNo').Value := trim(ADOQueryMain.Fieldbyname('MLColorNo').AsString);
|
|||
|
|
CDSMJID.FieldByName('GangNo').Value := trim(ADOQueryMain.Fieldbyname('GangNo').AsString);
|
|||
|
|
CDSMJID.FieldByName('JYLen').Value := ADOQueryMain.Fieldbyname('JYLen').AsFloat;
|
|||
|
|
CDSMJID.FieldByName('JYKG').Value := ADOQueryMain.Fieldbyname('JYKG').AsFloat;
|
|||
|
|
CDSMJID.FieldByName('JYJZ').Value := ADOQueryMain.Fieldbyname('JYJZ').AsFloat;
|
|||
|
|
CDSMJID.FieldByName('NewMLID').Value := trim(ADOQueryMain.Fieldbyname('NewMLID').AsString);
|
|||
|
|
CDSMJID.FieldByName('NewSubid').Value := trim(ADOQueryMain.Fieldbyname('NewSubid').AsString);
|
|||
|
|
CDSMJID.Post;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
|
|||
|
|
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmCPDBao := nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
writeCxGrid(self.Caption + tv1.Name, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
|
writeCxGrid(self.Caption + Tv2.Name, Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
|
Action := cafree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
readCxGrid(self.Caption + tv1.Name, Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
|
readCxGrid(self.Caption + Tv2.Name, Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
|
|||
|
|
Rolls := 0;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.SmNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
begin
|
|||
|
|
if key = #13 then
|
|||
|
|
begin
|
|||
|
|
if trim(smno.Text) = '' then
|
|||
|
|
exit;
|
|||
|
|
if CDSMJID.Locate('JYID', trim(smno.Text), []) then
|
|||
|
|
begin
|
|||
|
|
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C>ظ<EFBFBD>ɨ<EFBFBD><C9A8>.wav')) then
|
|||
|
|
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C>ظ<EFBFBD>ɨ<EFBFBD><C9A8>.wav'), 0, SND_ASYNC);
|
|||
|
|
smno.Text := '';
|
|||
|
|
smno.SetFocus;
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
if not CDSMJID.Locate('JYID', trim(smno.Text), []) then
|
|||
|
|
begin
|
|||
|
|
with ADOQuery1 do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
SQL.Add('select A.*,B.*,C.MLCodeName,C.MLOrderNo from JTJY_New A ');
|
|||
|
|
sql.add('inner join ML_OrderSubidNew B on B.NewSubid=A.NewSubid ');
|
|||
|
|
sql.add('inner join ML_OrderMainNew C on C.NewMLID=A.NewMLID ');
|
|||
|
|
sql.Add('where A.JYID=' + quotedstr(trim(SmNO.Text)));
|
|||
|
|
Open;
|
|||
|
|
if isempty then
|
|||
|
|
begin
|
|||
|
|
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
|
|||
|
|
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
|
|||
|
|
smno.Text := '';
|
|||
|
|
smno.SetFocus;
|
|||
|
|
exit;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
if Fieldbyname('RKType').AsString = '<27>ѳ<EFBFBD><D1B3><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
|
|||
|
|
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
|
|||
|
|
smno.Text := '';
|
|||
|
|
smno.SetFocus;
|
|||
|
|
exit;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
if CDSMJID.isempty = false then
|
|||
|
|
begin
|
|||
|
|
if not CDSMJID.Locate('NewSubid', trim(fieldbyname('NewSubid').AsString), []) then
|
|||
|
|
begin
|
|||
|
|
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
|
|||
|
|
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
|
|||
|
|
smno.Text := '';
|
|||
|
|
smno.SetFocus;
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
initMJID();
|
|||
|
|
smno.Text := '';
|
|||
|
|
smno.SetFocus;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.kcKwBtnClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'CPKWFlag';
|
|||
|
|
flagname := '<27><>λ<EFBFBD><CEBB>Ϣ';
|
|||
|
|
V1Name.Caption := '<27><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>';
|
|||
|
|
V1Note.Caption := 'Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
// MainType:=Trim(DName);
|
|||
|
|
fnote := FALSE;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
kcKw.Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.baoNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
var
|
|||
|
|
FBaoID: string;
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.SpeedButton1Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fsj: string;
|
|||
|
|
begin
|
|||
|
|
fsj := Trim(TSpeedButton(Sender).Hint);
|
|||
|
|
if Trim(fsj) = '' then
|
|||
|
|
Exit;
|
|||
|
|
fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
|
|||
|
|
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := fsj + Trim(TSpeedButton(Sender).Caption);
|
|||
|
|
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.SpeedButton12Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fsj: string;
|
|||
|
|
begin
|
|||
|
|
fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
|
|||
|
|
if Trim(fsj) = '' then
|
|||
|
|
Exit;
|
|||
|
|
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := Copy(fsj, 1, Length(fsj) - 1);
|
|||
|
|
TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelectAll;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.FileNameClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fPrintFile: string;
|
|||
|
|
Txt, fImagePath: string;
|
|||
|
|
Moudle: THandle;
|
|||
|
|
Makebar: TMakebar;
|
|||
|
|
Mixtext: TMixtext;
|
|||
|
|
FBaoID, FBaoNo: string;
|
|||
|
|
i: Integer;
|
|||
|
|
begin
|
|||
|
|
if CDSMJID.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select Max(cast(ISNULL(BaoNo,0) as Int))+1 BaoNo from JTJY_New ');
|
|||
|
|
sql.Add('where NewSubID=''' + Trim(CDSMJID.fieldbyname('NewSubID').AsString) + '''');
|
|||
|
|
sql.Add(' and GangNo=''' + Trim(CDSMJID.fieldbyname('GangNo').AsString) + '''');
|
|||
|
|
// ShowMessage(SQL.Text);
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
FBaoNo := Trim(ADOQueryCmd.fieldbyname('BaoNo').AsString);
|
|||
|
|
if GetLSNo(ADOQueryCmd, FBaoID, 'DB', 'JTJY_New', 4, 1) = False then
|
|||
|
|
begin
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
with CDSMJID do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
first;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update JTJY_New Set BaoNo=''' + trim(FBaoNo) + ''',BaoID=''' + trim(FBaoID) + ''' ');
|
|||
|
|
sql.Add('where JYID=''' + Trim(CDSMJID.fieldbyname('JYID').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update CK_MLCP_CR Set BaoNo=''' + trim(FBaoNo) + ''',BaoID=''' + trim(FBaoID) + ''' ');
|
|||
|
|
sql.Add('where MJID=''' + Trim(CDSMJID.fieldbyname('JYID').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
Delete;
|
|||
|
|
end;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><>ȷ.wav')) then
|
|||
|
|
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><>ȷ.wav'), 0, SND_ASYNC);
|
|||
|
|
except
|
|||
|
|
;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav')) then
|
|||
|
|
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.wav'), 0, SND_ASYNC);
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryPrint do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('exec JYOrder_DB ');
|
|||
|
|
sql.Add(' @BaoID=''' + trim(FBaoID) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryPrint.RecordCount > 1 then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>,<2C><><EFBFBD>ܴ<EFBFBD>ӡ', '<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
SInitCDSData20(ADOQueryPrint, CDSSEL);
|
|||
|
|
try
|
|||
|
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
|
Txt := trim(FBaoID);
|
|||
|
|
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
|
|||
|
|
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
|||
|
|
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
|||
|
|
if FileExists(fImagePath) then
|
|||
|
|
DeleteFile(fImagePath);
|
|||
|
|
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
|
|||
|
|
except
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + ADOQueryPrint.FieldByName('CPBaoBQName').AsString + '.rmf';
|
|||
|
|
if not FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
|
RM2.DefaultCopies := StrToIntDef(edtFenShu.Text, 1);
|
|||
|
|
//RM2.ShowReport;
|
|||
|
|
RM2.printReport;
|
|||
|
|
end;
|
|||
|
|
SmNO.SetFocus;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.cxButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.BaoBqBtnClick(Sender: TObject);
|
|||
|
|
type
|
|||
|
|
TMyFunc = function(App: Tapplication; FormH: hwnd; FormID: integer; Language: integer; WinStyle: integer; GCode: Pchar; GName: Pchar; DataBase: Pchar; Title: PChar; Parameters1: PChar; Parameters2: PChar; Parameters3: PChar; Parameters4: PChar; Parameters5: PChar; Parameters6: PChar; Parameters7: PChar; Parameters8: PChar; Parameters9: PChar; Parameters10: PChar; DataBaseStr: PChar): hwnd; stdcall;
|
|||
|
|
var
|
|||
|
|
Tf: TMyFunc;
|
|||
|
|
Tp: TFarProc;
|
|||
|
|
Th: Thandle;
|
|||
|
|
LabInt, labname: string;
|
|||
|
|
begin
|
|||
|
|
//if PPInt=2 then Exit;
|
|||
|
|
Ddatabase := StringOfChar(' ', 32);
|
|||
|
|
Th := LoadLibrary('LabelSet.dll');
|
|||
|
|
if Th > 0 then
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
Tp := GetProcAddress(Th, 'GetDllForm');
|
|||
|
|
if Tp <> nil then
|
|||
|
|
begin
|
|||
|
|
Tf := TMyFunc(Tp);
|
|||
|
|
newh := Tf(Application, 0, 2, 0, 0, PChar(DCode), PChar(DName), PChar(Ddatabase), PChar('<27><>ǩģ<C7A9><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'), PChar(''), PChar(''), '', '', '', '', '', '', '', '', PChar(DConString));
|
|||
|
|
if Trim(PChar(Ddatabase)) <> '' then
|
|||
|
|
begin
|
|||
|
|
Ddatabase := Trim(PChar(Ddatabase));
|
|||
|
|
// LabInt:=Trim( LeftBStr(Ddatabase,Pos('|',Ddatabase)-1) ) ;
|
|||
|
|
BaoBq.Text := Trim(RightBStr(Ddatabase, Length(Ddatabase) - Pos('|', Ddatabase)));
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
ShowMessage('<27><>ӡִ<D3A1>д<EFBFBD><D0B4><EFBFBD>');
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
// FreeLibrary();
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
ShowMessage('<27>Ҳ<EFBFBD><D2B2><EFBFBD>' + Trim('LabelSet.dll'));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.TV1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
begin
|
|||
|
|
if application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD>', '<27><>ʾ', 1) = 2 then
|
|||
|
|
Exit;
|
|||
|
|
CDSMJID.Delete;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.TV2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
begin
|
|||
|
|
if CDSSEL.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 1) = 2 then
|
|||
|
|
exit;
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update JTJY_New Set baoID='''',baoNo='''' ');
|
|||
|
|
sql.Add('where baoID=''' + Trim(CDSSEL.fieldbyname('baoID').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update CK_MLCP_CR Set BaoNo='''',BaoID='''' ');
|
|||
|
|
sql.Add('where BaoID=''' + Trim(CDSSEL.fieldbyname('BaoID').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
CDSSEL.delete;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
application.MessageBox('<27><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
|
exit;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox('<27><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
with ADOQuery1 do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
SQL.Add('select A.*,B.*,C.MLCodeName,C.MLOrderNo ');
|
|||
|
|
sql.Add(',cast(0 as decimal(18,2)) PS ');
|
|||
|
|
sql.Add('from JTJY_New A ');
|
|||
|
|
sql.add('inner join ML_OrderSubidNew B on B.NewSubid=A.NewSubid ');
|
|||
|
|
sql.add('inner join ML_OrderMainNew C on C.NewMLID=A.NewMLID ');
|
|||
|
|
sql.Add('where 1=2');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQuery1, CDSMJID);
|
|||
|
|
with ADOQueryPrint do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('exec JYOrder_DB ');
|
|||
|
|
sql.Add(' @BaoID=''û<><C3BB>''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryPrint, CDSSEL);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCPDBao.cxButton3Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fPrintFile: string;
|
|||
|
|
Txt, fImagePath: string;
|
|||
|
|
Moudle: THandle;
|
|||
|
|
Makebar: TMakebar;
|
|||
|
|
Mixtext: TMixtext;
|
|||
|
|
FBaoID, FBaoNo: string;
|
|||
|
|
i: Integer;
|
|||
|
|
begin
|
|||
|
|
if CDSSEL.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
FBaoID := CDSSEL.fieldbyname('BaoID').AsString;
|
|||
|
|
with ADOQueryPrint do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('exec JYOrder_DB ');
|
|||
|
|
sql.Add(' @BaoID=''' + trim(FBaoID) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryPrint.RecordCount > 1 then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>,<2C><><EFBFBD>ܴ<EFBFBD>ӡ', '<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
|
Txt := trim(FBaoID);
|
|||
|
|
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
|
|||
|
|
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
|||
|
|
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
|||
|
|
if FileExists(fImagePath) then
|
|||
|
|
DeleteFile(fImagePath);
|
|||
|
|
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
|
|||
|
|
except
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + ADOQueryPrint.FieldByName('CPBaoBQName').AsString + '.rmf';
|
|||
|
|
if not FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
|
RM2.DefaultCopies := StrToIntDef(edtFenShu.Text, 1);
|
|||
|
|
//RM2.ShowReport;
|
|||
|
|
RM2.printReport;
|
|||
|
|
end;
|
|||
|
|
SmNO.SetFocus;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|
|||
|
|
|