1315 lines
35 KiB
ObjectPascal
1315 lines
35 KiB
ObjectPascal
![]() |
unit U_TableInspection;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, StdCtrls, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
|||
|
cxDataStorage, cxEdit, DB, cxDBData, cxCalendar, cxGridLevel,
|
|||
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
|||
|
cxControls, cxGridCustomView, cxGrid, RM_Common, RM_Class, RM_GridReport,
|
|||
|
RM_System, RM_Dataset, ADODB, DBClient, cxGridCustomPopupMenu, cxGridPopupMenu,
|
|||
|
ExtCtrls, ComCtrls, ToolWin, cxTextEdit, Buttons, cxSplitter, cxCheckBox,
|
|||
|
MovePanel;
|
|||
|
{function CommOpen(fhandle:hwnd;sCommName:PAnsiChar;
|
|||
|
IntTime:integer):integer;stdcall;external 'JCYData.DLL';
|
|||
|
function CommClose(sCommName:PAnsiChar):integer;stdcall;external 'JCYData.DLL';
|
|||
|
function CommOpen(fhandle:hwnd;sCommName:PAnsiChar;
|
|||
|
IntTime:integer;IsMessage:integer):integer;stdcall;external 'JCYData.DLL';
|
|||
|
function CommClose(sCommName:PAnsiChar):integer;stdcall;external 'JCYData.DLL';
|
|||
|
function CommOpen(fhandle:hwnd;sCommName:PAnsiChar;
|
|||
|
IntTime:integer;IsMessage:integer):integer;stdcall;external 'JZCRS323C.DLL';
|
|||
|
function CommClose(sCommName:PAnsiChar):integer;stdcall;external 'JZCRS323C.DLL';
|
|||
|
|
|||
|
function GetCommData(fhandle:hwnd;var defnum1,defnum2:double;var fisjz:integer):integer;stdcall;external 'JZCRS323C.DLL';
|
|||
|
|
|||
|
function CommOpen1301(fhandle:hwnd;sCommName:PAnsiChar;
|
|||
|
IntTime:integer;IsMessage:integer):integer;stdcall;external 'JZCRS323C.DLL';
|
|||
|
function CommClose1301(sCommName:PAnsiChar):integer;stdcall;external 'JZCRS323C.DLL';
|
|||
|
|
|||
|
function GetCommData1301(fhandle:hwnd;var defnum1,defnum2:double;var fisjz:integer):integer;stdcall;external 'JZCRS323C.DLL'; }
|
|||
|
|
|||
|
type
|
|||
|
TfrmTableInspection = class(TForm)
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
cxStyle2: TcxStyle;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
DataSource1: TDataSource;
|
|||
|
Order_MJ: TClientDataSet;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOCmd: TADOQuery;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
RM2: TRMGridReport;
|
|||
|
cxGrid3: TcxGrid;
|
|||
|
Tv3: TcxGridDBTableView;
|
|||
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
cxGridLevel2: TcxGridLevel;
|
|||
|
DataSource2: TDataSource;
|
|||
|
CDS_MJCD: TClientDataSet;
|
|||
|
DataSource3: TDataSource;
|
|||
|
CDS_MJID: TClientDataSet;
|
|||
|
Timer1: TTimer;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
ScrollBox1: TScrollBox;
|
|||
|
SpeedButton13: TSpeedButton;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
ADOQueryMainDSC: TADOQuery;
|
|||
|
Panel2: TPanel;
|
|||
|
Label9: TLabel;
|
|||
|
MJLen: TEdit;
|
|||
|
Label4: TLabel;
|
|||
|
MJMaoZ: TEdit;
|
|||
|
Label5: TLabel;
|
|||
|
Label11: TLabel;
|
|||
|
BTPrint: TButton;
|
|||
|
Button5: TButton;
|
|||
|
Panel3: TPanel;
|
|||
|
SpeedButton1: TSpeedButton;
|
|||
|
SpeedButton2: TSpeedButton;
|
|||
|
SpeedButton3: TSpeedButton;
|
|||
|
SpeedButton4: TSpeedButton;
|
|||
|
SpeedButton5: TSpeedButton;
|
|||
|
SpeedButton6: TSpeedButton;
|
|||
|
SpeedButton7: TSpeedButton;
|
|||
|
SpeedButton8: TSpeedButton;
|
|||
|
SpeedButton9: TSpeedButton;
|
|||
|
SpeedButton10: TSpeedButton;
|
|||
|
SpeedButton11: TSpeedButton;
|
|||
|
SpeedButton12: TSpeedButton;
|
|||
|
SpeedButton49: TSpeedButton;
|
|||
|
v3Column1: TcxGridDBColumn;
|
|||
|
v3Column2: TcxGridDBColumn;
|
|||
|
v3Column3: TcxGridDBColumn;
|
|||
|
MovePanel1: TMovePanel;
|
|||
|
Label17: TLabel;
|
|||
|
Label18: TLabel;
|
|||
|
Label20: TLabel;
|
|||
|
Label7: TLabel;
|
|||
|
Label8: TLabel;
|
|||
|
Edit1: TEdit;
|
|||
|
Button1: TButton;
|
|||
|
Button4: TButton;
|
|||
|
Edit2: TEdit;
|
|||
|
CDQty: TEdit;
|
|||
|
RadioGroup1: TRadioGroup;
|
|||
|
Button2: TButton;
|
|||
|
v3Column4: TcxGridDBColumn;
|
|||
|
v3Column5: TcxGridDBColumn;
|
|||
|
RM3: TRMGridReport;
|
|||
|
ADOTmp: TADOQuery;
|
|||
|
Panel5: TPanel;
|
|||
|
Panel6: TPanel;
|
|||
|
Label1: TLabel;
|
|||
|
lblOrderNo: TLabel;
|
|||
|
Label35: TLabel;
|
|||
|
Label39: TLabel;
|
|||
|
APID: TEdit;
|
|||
|
Edit7: TEdit;
|
|||
|
Edit8: TEdit;
|
|||
|
ToolBar1: TToolBar;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
TBCD: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
lblMPRTCodeName: TLabel;
|
|||
|
lblcolor: TLabel;
|
|||
|
SpeedButton14: TSpeedButton;
|
|||
|
SpeedButton15: TSpeedButton;
|
|||
|
SpeedButton16: TSpeedButton;
|
|||
|
SpeedButton17: TSpeedButton;
|
|||
|
SpeedButton18: TSpeedButton;
|
|||
|
SpeedButton19: TSpeedButton;
|
|||
|
SpeedButton20: TSpeedButton;
|
|||
|
SpeedButton21: TSpeedButton;
|
|||
|
SpeedButton22: TSpeedButton;
|
|||
|
SpeedButton23: TSpeedButton;
|
|||
|
SpeedButton24: TSpeedButton;
|
|||
|
SpeedButton25: TSpeedButton;
|
|||
|
SpeedButton26: TSpeedButton;
|
|||
|
SpeedButton27: TSpeedButton;
|
|||
|
SpeedButton28: TSpeedButton;
|
|||
|
SpeedButton29: TSpeedButton;
|
|||
|
SpeedButton30: TSpeedButton;
|
|||
|
SpeedButton31: TSpeedButton;
|
|||
|
SpeedButton32: TSpeedButton;
|
|||
|
SpeedButton33: TSpeedButton;
|
|||
|
lblrcgangNo: TLabel;
|
|||
|
lblPiQty: TLabel;
|
|||
|
lblPBFactoryName: TLabel;
|
|||
|
lblFactoryName: TLabel;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
Tv2: TcxGridDBTableView;
|
|||
|
tv2CDType: TcxGridDBColumn;
|
|||
|
tv2CDWZ: TcxGridDBColumn;
|
|||
|
v2Column2: TcxGridDBColumn;
|
|||
|
Tv2CDQty: TcxGridDBColumn;
|
|||
|
Tv2CDReason: TcxGridDBColumn;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
v2Column3: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
Label21: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
JYY1: TEdit;
|
|||
|
SpeedButton34: TSpeedButton;
|
|||
|
SpeedButton35: TSpeedButton;
|
|||
|
SpeedButton36: TSpeedButton;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCDClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure MJMaoZClick(Sender: TObject);
|
|||
|
procedure MJLenClick(Sender: TObject);
|
|||
|
procedure Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure Tv3CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure FormClick(Sender: TObject);
|
|||
|
procedure Button12Click(Sender: TObject);
|
|||
|
procedure BTPrintClick(Sender: TObject);
|
|||
|
procedure Tv2CDQtyPropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure SpeedButton1Click(Sender: TObject);
|
|||
|
procedure SpeedButton12Click(Sender: TObject);
|
|||
|
procedure SpeedButton13Click(Sender: TObject);
|
|||
|
procedure cxGridDBColumn2PropertiesChange(Sender: TObject);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure Button5Click(Sender: TObject);
|
|||
|
procedure SpeedButton49Click(Sender: TObject);
|
|||
|
procedure APIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure Edit1Click(Sender: TObject);
|
|||
|
procedure Edit2Change(Sender: TObject);
|
|||
|
procedure MJstr3KeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure Label9Click(Sender: TObject);
|
|||
|
procedure Button2Click(Sender: TObject);
|
|||
|
procedure APIDClick(Sender: TObject);
|
|||
|
procedure Edit7Click(Sender: TObject);
|
|||
|
procedure MJQty4KeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure MJQty2Change(Sender: TObject);
|
|||
|
procedure Edit8Click(Sender: TObject);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
FInt, PState, PrintInt, SCInitGrid, FState, FCK: Integer;
|
|||
|
FColumn, FAPID, FMainId, FSubId, FFFMJID, FYXJL: string;
|
|||
|
MValue, FCDName: string;
|
|||
|
isCommopen, IsJsMessage: boolean;
|
|||
|
fxsType, fRollType: string;
|
|||
|
procedure InitJP();
|
|||
|
procedure InitCDGrid();
|
|||
|
procedure InitCDGridID();
|
|||
|
function SaveData(MMJType: string): Boolean;
|
|||
|
procedure InitLCK(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD>
|
|||
|
procedure ClearGlobal(); //<2F><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>ID
|
|||
|
function CheckData(CKType: string): Boolean;
|
|||
|
procedure PrintCKMDG(MRKOrdID: string);
|
|||
|
procedure PrtData(FMJID: string);
|
|||
|
procedure OpenCom(DllName: string);
|
|||
|
procedure CloseCom(DllName: string);
|
|||
|
procedure On1201(var Message: Tmessage); message 1201;
|
|||
|
procedure On1301(var Message: Tmessage); message 1301;
|
|||
|
public
|
|||
|
fmanage: string;
|
|||
|
{ Public declarations }
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmTableInspection: TfrmTableInspection;
|
|||
|
newh, newh1: hwnd;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_Fun, U_ZDYHelp, U_iniParam, U_ProductOrderListSel;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmTableInspection.ClearGlobal();
|
|||
|
begin
|
|||
|
FAPID := '';
|
|||
|
FMainId := '';
|
|||
|
FSubId := '';
|
|||
|
lblOrderNo.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
lblMPRTCodeName.Caption := 'Ʒ<><C6B7>';
|
|||
|
lblcolor.Caption := '<27><>ɫ';
|
|||
|
lblrcgangNo.Caption := '<27><EFBFBD>';
|
|||
|
lblPBFactoryName.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
lblFactoryName.Caption := 'Ⱦ<><C8BE>';
|
|||
|
lblPiQty.Caption := 'ƥ<><C6A5>';
|
|||
|
APID.SetFocus;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmTableInspection.CheckData(CKType: string): Boolean;
|
|||
|
var
|
|||
|
mvalue: Double;
|
|||
|
begin
|
|||
|
try
|
|||
|
if Trim(FAPID) = '' then
|
|||
|
raise Exception.Create('<27><>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD><CCBF><EFBFBD>');
|
|||
|
if Trim(FMainId) = '' then
|
|||
|
raise Exception.Create('<27><>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD><CCBF><EFBFBD>');
|
|||
|
if Trim(FSubId) = '' then
|
|||
|
raise Exception.Create('<27><>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD><CCBF><EFBFBD>');
|
|||
|
if Trim(CKType) = '<27>ύ' then
|
|||
|
begin
|
|||
|
if trim(JYY1.Text) = '' then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
|
|||
|
if CDS_MJCD.IsEmpty then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>!');
|
|||
|
|
|||
|
if trim(Label9.Caption) = '' then
|
|||
|
raise Exception.Create('<27><><EFBFBD>ȵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
|
|||
|
|
|||
|
if Trim(MJMaoZ.Text) <> '' then
|
|||
|
begin
|
|||
|
if TryStrToFloat(MJMaoZ.Text, mvalue) = False then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
|
|||
|
|
|||
|
if Length(trim(MJMaoZ.Text)) <> 4 then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD> XX.X!');
|
|||
|
if pos('.', trim(MJMaoZ.Text)) <> 3 then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD> XX.X!');
|
|||
|
|
|||
|
if strtofloatdef(trim(MJMaoZ.Text), 0) > 80 then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD>80!');
|
|||
|
|
|||
|
if strtofloatdef(trim(MJMaoZ.Text), 0) < 0 then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>0!');
|
|||
|
end;
|
|||
|
if Trim(MJLen.Text) <> '' then
|
|||
|
begin
|
|||
|
if TryStrToFloat(MJLen.Text, mvalue) = False then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
|
|||
|
|
|||
|
if Length(trim(MJLen.Text)) <> 5 then
|
|||
|
raise Exception.Create('<27><><EFBFBD>ȸ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD> XXX.X!');
|
|||
|
|
|||
|
if pos('.', trim(MJLen.Text)) <> 4 then
|
|||
|
raise Exception.Create('<27><><EFBFBD>ȸ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD> XXX.X!');
|
|||
|
|
|||
|
if strtofloatdef(trim(MJLen.Text), 0) > 400 then
|
|||
|
raise Exception.Create('<27><><EFBFBD>Ȳ<EFBFBD><C8B2>ܴ<EFBFBD><DCB4><EFBFBD>400!');
|
|||
|
|
|||
|
if strtofloatdef(trim(MJLen.Text), 0) < 0.00 then
|
|||
|
raise Exception.Create('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>С<EFBFBD><D0A1>0!');
|
|||
|
end;
|
|||
|
|
|||
|
if (strtofloatdef(trim(MJLen.Text), 0) = 0) and (strtofloatdef(trim(MJMaoZ.Text), 0) = 0) then
|
|||
|
raise Exception.Create('<27><><EFBFBD>Ⱥ<EFBFBD><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD>Ϊ0!!');
|
|||
|
end;
|
|||
|
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
Result := false;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.PrintCKMDG(MRKOrdID: string);
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.InitLCK();
|
|||
|
begin
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.*,B.*,C.* ');
|
|||
|
sql.Add(',maxRoll=1+isnull((select cast (max(mjxh) as int) from WFB_MJJY X where X.APID=A.SPID),0)');
|
|||
|
sql.Add('from CK_SXPB_CR A');
|
|||
|
sql.Add('inner join JYOrder_Main B on A.ORDMainIdRK=B.MainId');
|
|||
|
sql.Add('inner join JYOrder_Sub C on A.ORDSubIdRK=C.SubId');
|
|||
|
sql.Add('where SPID=''' + Trim(APID.Text) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOTmp.IsEmpty = False then
|
|||
|
begin
|
|||
|
FAPID := Trim(APID.Text);
|
|||
|
APID.Text := '';
|
|||
|
FMainId := Trim(ADOTmp.fieldbyname('ORDMainIdRK').AsString);
|
|||
|
FSubId := Trim(ADOTmp.fieldbyname('ORDSubIdRK').AsString);
|
|||
|
FYXJL := Trim(ADOTmp.fieldbyname('YXJL').AsString);
|
|||
|
|
|||
|
lblOrderNo.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>' + Trim(ADOTmp.fieldbyname('conno').AsString);
|
|||
|
lblMPRTCodeName.Caption := 'Ʒ<><C6B7><EFBFBD><EFBFBD>' + Trim(ADOTmp.fieldbyname('MPRTCodeName').AsString);
|
|||
|
lblcolor.Caption := '<27><>ɫ<EFBFBD><C9AB>' + trim(ADOTmp.fieldbyname('PRTColor').AsString);
|
|||
|
lblrcgangNo.Caption := '<27>ţ<D7BA>' + Trim(ADOTmp.fieldbyname('rcgangNo').AsString);
|
|||
|
lblPBFactoryName.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + Trim(ADOTmp.fieldbyname('PBFactoryName').AsString);
|
|||
|
lblFactoryName.Caption := 'Ⱦ<><C8BE><EFBFBD><EFBFBD>' + Trim(ADOTmp.fieldbyname('FactoryName').AsString);
|
|||
|
lblPiQty.Caption := 'ƥ<><C6A5><EFBFBD><EFBFBD>' + Trim(ADOTmp.fieldbyname('PiQty').AsString);
|
|||
|
if Trim(ADOTmp.fieldbyname('OrderUnit').AsString) <> '' then
|
|||
|
begin
|
|||
|
Label20.Caption := Label9.Caption;
|
|||
|
Label7.Caption := Label9.Caption;
|
|||
|
end;
|
|||
|
|
|||
|
if FYXJL = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
MJLen.SetFocus;
|
|||
|
Edit1Click(MJLen);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
MJMaoZ.SetFocus;
|
|||
|
Edit1Click(MJMaoZ);
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
ClearGlobal();
|
|||
|
end;
|
|||
|
InitCDGridID();
|
|||
|
InitCDGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.CloseCom(DllName: string);
|
|||
|
type
|
|||
|
TMyFunc = function(sCommName: PAnsiChar): HWND; stdcall;
|
|||
|
var
|
|||
|
Tf1: TMyFunc;
|
|||
|
Tp1: TFarProc;
|
|||
|
Th1: Thandle;
|
|||
|
begin
|
|||
|
Th1 := LoadLibrary(Pchar(trim(DllName)));
|
|||
|
if Th1 > 0 then
|
|||
|
begin
|
|||
|
try
|
|||
|
Tp1 := GetProcAddress(Th1, 'CommClose');
|
|||
|
if Tp1 <> nil then
|
|||
|
begin
|
|||
|
Tf1 := TMyFunc(Tp1);
|
|||
|
newh1 := Tf1('Comm1');
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
finally
|
|||
|
// FreeLibrary(Th1);
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + ' <20>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.OpenCom(DllName: string);
|
|||
|
type
|
|||
|
TMyFunc = function(fhandle: hwnd; sCommName: PAnsiChar; IntTime: integer; IsMessage: integer): HWND; stdcall;
|
|||
|
var
|
|||
|
Tf: TMyFunc;
|
|||
|
Tp: TFarProc;
|
|||
|
Th: Thandle;
|
|||
|
begin
|
|||
|
// closeCom(FComFile);
|
|||
|
Th := LoadLibrary(Pchar(trim(DllName)));
|
|||
|
if Th > 0 then
|
|||
|
begin
|
|||
|
try
|
|||
|
Tp := GetProcAddress(Th, 'CommOpen');
|
|||
|
if Tp <> nil then
|
|||
|
begin
|
|||
|
Tf := TMyFunc(Tp);
|
|||
|
newh := Tf(self.Handle, 'Comm1', 500, 1);
|
|||
|
if newh < 1 then
|
|||
|
begin
|
|||
|
application.MessageBox(Pchar('<27><EFBFBD><F2BFAAB4><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>'), '<27><>ʾ');
|
|||
|
end
|
|||
|
else
|
|||
|
IsCommOpen := true;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
IsCommOpen := false;
|
|||
|
end;
|
|||
|
finally
|
|||
|
// FreeLibrary(Th);
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
IsCommOpen := false;
|
|||
|
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + ' <20>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmTableInspection := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.On1301(var Message: Tmessage);
|
|||
|
var
|
|||
|
i1, i2: integer;
|
|||
|
unitname: string;
|
|||
|
fdata: double;
|
|||
|
begin
|
|||
|
i1 := Message.WParam;
|
|||
|
i2 := Message.LParam;
|
|||
|
if IsJsMessage then
|
|||
|
begin
|
|||
|
if (trim(Edit7.Text) = '<27><>') then
|
|||
|
begin
|
|||
|
MJLen.Text := format('%.f', [i1 / 100000]);
|
|||
|
if i2 = 0 then
|
|||
|
Label9.Caption := 'M'
|
|||
|
else
|
|||
|
Label9.Caption := 'Y';
|
|||
|
edit1.Text := format('%.1f', [i1 / 100000]);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.On1201(var Message: Tmessage);
|
|||
|
var
|
|||
|
i1, i2: integer;
|
|||
|
unitname: string;
|
|||
|
fdata: double;
|
|||
|
begin
|
|||
|
i1 := Message.WParam;
|
|||
|
i2 := Message.LParam;
|
|||
|
if IsJsMessage then
|
|||
|
begin
|
|||
|
if trim(Edit7.Text) = '<27><>' then
|
|||
|
begin
|
|||
|
MJMaoZ.Text := format('%.1f', [i1 / 100000]);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
//DataLink_WFBProducttion.ADOLink.Connected:=False;
|
|||
|
|
|||
|
if isCommopen then
|
|||
|
begin
|
|||
|
closeCom(MBDYDllName);
|
|||
|
closeCom(MBDYDllName);
|
|||
|
end;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.InitCDGrid();
|
|||
|
begin
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from WFB_MJJY_CD where MJID='''' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_MJCD);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_MJCD);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.InitCDGridID();
|
|||
|
begin
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select A.*');
|
|||
|
sql.Add('from WFB_MJJY A where APID=''' + Trim(FAPID) + '''');
|
|||
|
if Trim(SCXFlag) <> '' then
|
|||
|
sql.Add(' and JTType=''' + Trim(SCXFlag) + '''');
|
|||
|
sql.Add(' and Filler=''' + Trim(DName) + '''');
|
|||
|
sql.Add(' and MJstr2=''δ<><CEB4><EFBFBD><EFBFBD>'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_MJID);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_MJID);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.TBCDClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := 'WFBCD';
|
|||
|
flagname := '<27>õ<EFBFBD>';
|
|||
|
fnote := True;
|
|||
|
V1Note.Caption := 'Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.InitJP();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
InitJP();
|
|||
|
if IsINIFile() then
|
|||
|
ReadINIFile()
|
|||
|
else
|
|||
|
WriteINIFile;
|
|||
|
if trim(Edit7.Text) = '<27><>' then
|
|||
|
IsJsMessage := true;
|
|||
|
|
|||
|
if trim(fmanage) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
begin
|
|||
|
if trim(DZCDYDllName) <> '' then
|
|||
|
OpenCom(DZCDYDllName);
|
|||
|
if trim(MBDYDllName) <> '' then
|
|||
|
OpenCom(MBDYDllName);
|
|||
|
Edit7.Visible := true;
|
|||
|
Label35.Visible := true;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.InitJP();
|
|||
|
var
|
|||
|
AA: array[0..100] of string;
|
|||
|
i, j: Integer;
|
|||
|
begin
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select ZDYName from KH_Zdy where Type=''WFBCD'' order by ZDYNO ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOTmp.IsEmpty then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>õ㣡', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
First;
|
|||
|
i := 0;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
AA[i] := Trim(fieldbyname('ZDYName').AsString);
|
|||
|
i := i + 1;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
i := i - 1;
|
|||
|
if i > 24 then
|
|||
|
begin
|
|||
|
i := 24;
|
|||
|
end;
|
|||
|
for j := 0 to i do
|
|||
|
begin
|
|||
|
with ScrollBox1 do
|
|||
|
begin
|
|||
|
TSpeedButton(Controls[j]).Visible := True;
|
|||
|
TSpeedButton(Controls[j]).Hint := AA[j];
|
|||
|
if Length(AA[j]) > 4 then
|
|||
|
begin
|
|||
|
TSpeedButton(Controls[j]).Caption := Copy(Trim(AA[j]), 1, 4) + #13 + Copy(Trim(AA[j]), 5, Length(AA[j]) - 4);
|
|||
|
end
|
|||
|
else
|
|||
|
TSpeedButton(Controls[j]).Caption := AA[j];
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
if CDS_MJCD.IsEmpty then
|
|||
|
Exit;
|
|||
|
if Trim(CDS_MJCD.fieldbyname('MCID').AsString) = '' then
|
|||
|
begin
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
CDS_MJCD.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.MJMaoZClick(Sender: TObject);
|
|||
|
begin
|
|||
|
FInt := 1;
|
|||
|
FColumn := '';
|
|||
|
panel3.Visible := True;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.MJLenClick(Sender: TObject);
|
|||
|
begin
|
|||
|
FInt := 2;
|
|||
|
FColumn := '';
|
|||
|
panel3.Visible := True;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
InitCDGridID();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.Tv3CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
exit;
|
|||
|
if CDS_MJCD.IsEmpty = False then
|
|||
|
begin
|
|||
|
if Trim(CDS_MJCD.fieldbyname('MJID').AsString) = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
InitCDGrid();
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from WFB_MJJY where MJID=''' + Trim(CDS_MJID.fieldbyname('MJID').AsString) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
MJMaoZ.Text := Trim(ADOTmp.fieldbyname('MJMaoZ').AsString);
|
|||
|
MJLen.Text := Trim(ADOTmp.fieldbyname('MJLen').AsString);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.FormClick(Sender: TObject);
|
|||
|
begin
|
|||
|
FInt := 4;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.Button12Click(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
if PState < 1 then
|
|||
|
Exit;
|
|||
|
if Trim(FAPID) = '' then
|
|||
|
Exit;
|
|||
|
if FInt = 4 then
|
|||
|
Exit;
|
|||
|
begin
|
|||
|
FColumn := Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
|||
|
if Trim(FColumn) <> '' then
|
|||
|
begin
|
|||
|
if Trim(CDS_MJCD.FieldByName(FColumn).AsString) <> '' then
|
|||
|
begin
|
|||
|
with CDS_MJCD do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
if Length(CDS_MJCD.FieldByName(FColumn).AsString) = 1 then
|
|||
|
begin
|
|||
|
FieldByName(FColumn).Value := null;
|
|||
|
FieldByName('CDQty').Value := 0;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
FieldByName(FColumn).Value := Copy(Trim(FieldByName(FColumn).AsString), 1, Length(Trim(FieldByName(FColumn).AsString)) - 1);
|
|||
|
FieldByName('CDQty').Value := FieldByName(FColumn).Value;
|
|||
|
end;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmTableInspection.SaveData(MMJType: string): Boolean;
|
|||
|
var
|
|||
|
maxno, FMJID, BZID, strsql: string;
|
|||
|
FMJLen: Double;
|
|||
|
FOrder: Integer;
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOCmd.Connection.BeginTrans;
|
|||
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select * from WFB_MJJY where 1=2');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
if GetLSNo(ADOTmp, maxno, Trim(SCXFlag), 'WFB_MJJY', 4, 1) = False then
|
|||
|
begin
|
|||
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
FieldByName('MainId').value := Trim(FMainId);
|
|||
|
FieldByName('SubId').value := Trim(FSubId);
|
|||
|
FieldByName('FromMainId').value := Trim(FMainId);
|
|||
|
FieldByName('FromSubId').value := Trim(FSubId);
|
|||
|
FieldByName('APId').value := Trim(FAPID);
|
|||
|
FieldByName('MJID').Value := Trim(maxno);
|
|||
|
FieldByName('MJStr2').Value := 'δ<><CEB4><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('MJType').Value := MMJType;
|
|||
|
FieldByName('MJXH').Value := 0;
|
|||
|
FieldByName('MJTypeOther').Value := Trim(Label9.Caption);
|
|||
|
FieldByName('JYY1').Value := Trim(JYY1.Text) + '<27><><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('MJLen').Value := StrToFloatdef(trim(MJLen.Text), 0);
|
|||
|
//ë<><C3AB>
|
|||
|
FieldByName('MJMaoZ').Value := StrToFloatdef(trim(MJMaoZ.Text), 0);
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
FieldByName('MJQty4').Value := StrToFloatdef(trim(MJMaoZ.Text), 0);
|
|||
|
|
|||
|
if Trim(FMJID) = '' then
|
|||
|
begin
|
|||
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
FieldByName('Editer').Value := Trim(DName);
|
|||
|
FieldByName('EditTime').Value := SGetServerDateTime(ADOTmp);
|
|||
|
end;
|
|||
|
if Trim(SCXFlag) <> '' then
|
|||
|
begin
|
|||
|
FieldByName('JTType').Value := Trim(SCXFlag);
|
|||
|
end;
|
|||
|
FieldByName('MJTypeOther').Value := Trim(Label9.Caption);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
FMJID := Trim(maxno);
|
|||
|
FFFMJID := Trim(maxno);
|
|||
|
///<2F><><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>
|
|||
|
with CDS_MJCD do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if Trim(CDS_MJCD.fieldbyname('MCID').AsString) = '' then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOTmp, maxno, 'MC', 'WFB_MJJY_CD', 5, 1) = False then
|
|||
|
begin
|
|||
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
maxno := Trim(CDS_MJCD.fieldbyname('MCID').AsString);
|
|||
|
end;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from WFB_MJJY_CD ');
|
|||
|
sql.Add(' where MCID=''' + Trim(maxno) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
if Trim(CDS_MJCD.fieldbyname('MCID').AsString) = '' then
|
|||
|
Append
|
|||
|
else
|
|||
|
Edit;
|
|||
|
FieldByName('MJId').Value := Trim(FMJID);
|
|||
|
FieldByName('MCID').Value := Trim(maxno);
|
|||
|
SSetSaveDataCDSNew(ADOCmd, Tv2, CDS_MJCD, 'WFB_MJJY_CD', 0);
|
|||
|
FieldByName('KouFenType').Value := CDS_MJCD.fieldbyname('KouFenType').Value;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
CDS_MJCD.Edit;
|
|||
|
CDS_MJCD.FieldByName('MCID').Value := Trim(maxno);
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update WFB_MJJY SET CDList= dbo.F_Get_Order_SubStr(MJID,''MJCDHZSL'')');
|
|||
|
sql.Add('where MJID=''' + Trim(FMJID) + ''' ');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>⼰<EFBFBD><E2BCB0><EFBFBD><EFBFBD>
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Do_JYCRK @MJID=''' + trim(FMJID) + '''');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD>¿<EFBFBD><C2BF><EFBFBD>
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_UPdate_LCKJY @APID=''' + trim(FAPID) + '''');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
ADOCmd.Connection.CommitTrans;
|
|||
|
Result := True;
|
|||
|
PState := 0;
|
|||
|
except
|
|||
|
Result := False;
|
|||
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.BTPrintClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
mvalue: Double;
|
|||
|
i: Integer;
|
|||
|
begin
|
|||
|
APID.SetFocus;
|
|||
|
if CheckData('<27>ύ') = False then
|
|||
|
exit;
|
|||
|
if SaveData('<27><>Ʒ') then
|
|||
|
begin
|
|||
|
MJLen.Text := '';
|
|||
|
MJMaoZ.Text := '';
|
|||
|
JYY1.Text := '';
|
|||
|
end;
|
|||
|
PrtData(FFFMJID);
|
|||
|
InitCDGridID();
|
|||
|
InitCDGrid();
|
|||
|
|
|||
|
if FYXJL = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
MJLen.SetFocus;
|
|||
|
Edit1Click(MJLen);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
MJMaoZ.SetFocus;
|
|||
|
Edit1Click(MJMaoZ);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.PrtData(FMJID: string);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' EXEC P_Print_JYLab ');
|
|||
|
SQL.Add(' @MJID=''' + Trim(FMJID) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryPrint.IsEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := Trim(ADOQueryPrint.fieldbyname('MJID').AsString);
|
|||
|
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;
|
|||
|
|
|||
|
ExportFtErpFile('<27><>Ʒ<EFBFBD><C6B7>ǩ.rmf', ADOTmp);
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><>Ʒ<EFBFBD><C6B7>ǩ.rmf';
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
Rm2.DefaultCopies := 2;
|
|||
|
RM2.PrintReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.Tv2CDQtyPropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue: string;
|
|||
|
begin
|
|||
|
try
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
if Trim(mvalue) <> '' then
|
|||
|
begin
|
|||
|
CDS_MJCD.Edit;
|
|||
|
CDS_MJCD.FieldByName('CDQty').Value := mvalue;
|
|||
|
CDS_MJCD.Post;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
CDS_MJCD.Edit;
|
|||
|
CDS_MJCD.FieldByName('CDQty').Value := 0;
|
|||
|
CDS_MJCD.Post;
|
|||
|
end;
|
|||
|
CDS_MJCD.Edit;
|
|||
|
CDS_MJCD.FieldByName('CDQtyS').Value := mvalue;
|
|||
|
except
|
|||
|
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>֣<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.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 TfrmTableInspection.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 TfrmTableInspection.SpeedButton13Click(Sender: TObject);
|
|||
|
var
|
|||
|
i: Integer;
|
|||
|
begin
|
|||
|
|
|||
|
if CheckData('<27>õ<EFBFBD>') = False then
|
|||
|
exit;
|
|||
|
|
|||
|
//<2F><>ʾ<EFBFBD>õ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
FCDName := Trim(TSpeedButton(Sender).Hint);
|
|||
|
// MovePanel1.Visible := True;
|
|||
|
Label21.Caption := Trim(FCDName);
|
|||
|
Button1.Click;
|
|||
|
//<2F><>ʾ<EFBFBD><CABE><EFBFBD>ּ<EFBFBD><D6BC><EFBFBD>
|
|||
|
// Edit1.SetFocus;
|
|||
|
// Panel3.Visible := True;
|
|||
|
// with Panel3 do
|
|||
|
// begin
|
|||
|
// for i := 0 to ControlCount - 1 do
|
|||
|
// begin
|
|||
|
// if Controls[i] is TSpeedButton then
|
|||
|
// begin
|
|||
|
// TSpeedButton(Controls[i]).Hint := Trim(Edit1.Name);
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.cxGridDBColumn2PropertiesChange(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
|
|||
|
fsj := Trim(Order_MJ.fieldbyname('SubId').AsString);
|
|||
|
Order_MJ.DisableControls;
|
|||
|
with Order_MJ do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if Trim(Order_MJ.fieldbyname('SubId').AsString) <> fsj then
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value := False;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Order_MJ.EnableControls;
|
|||
|
Order_MJ.Locate('SubId', fsj, []);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.Button1Click(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue: Double;
|
|||
|
begin
|
|||
|
{ if Trim(Edit1.Text)='' then
|
|||
|
begin
|
|||
|
Application.MessageBox('λ<>ò<EFBFBD><C3B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
|
|||
|
exit;
|
|||
|
end; }
|
|||
|
if Trim(Edit1.Text) <> '' then
|
|||
|
begin
|
|||
|
if Trim(Edit2.Text) <> '' then
|
|||
|
begin
|
|||
|
if StrToFloat(Edit2.Text) < StrToFloat(Edit1.Text) then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>õ<EFBFBD>λ<EFBFBD><CEBB>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if CDQty.Text <> '' then
|
|||
|
begin
|
|||
|
if TryStrToFloat(CDQty.Text, mvalue) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
with CDS_MJCD do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('cdname').Value := Trim(FCDName);
|
|||
|
FieldByName('CDbeg').Value := Trim(Edit1.Text);
|
|||
|
FieldByName('CDEnd').Value := Trim(Edit2.Text);
|
|||
|
FieldByName('KouFenQty').Value := 0;
|
|||
|
if RadioGroup1.ItemIndex > -1 then
|
|||
|
FieldByName('KouFenType').Value := RadioGroup1.Items.Strings[RadioGroup1.ItemIndex];
|
|||
|
if RadioGroup1.ItemIndex > -1 then
|
|||
|
begin
|
|||
|
if RadioGroup1.ItemIndex < 3 then
|
|||
|
begin
|
|||
|
FieldByName('KouFenQty').Value := RadioGroup1.ItemIndex + 1;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
FieldByName('KouFenQty').Value := 4;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Trim(FCDName) = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
FieldByName('KouFenQty').Value := 0;
|
|||
|
FieldByName('CDQty').Value := StrToFloatdef(trim(CDQty.Text), 0);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
Edit1.Text := '';
|
|||
|
Edit2.Text := '';
|
|||
|
CDQty.Text := '';
|
|||
|
MovePanel1.Visible := False;
|
|||
|
Panel3.Visible := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
InitJP();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.Button5Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
i: Integer;
|
|||
|
mvalue: Double;
|
|||
|
begin
|
|||
|
if CDS_MJID.IsEmpty then
|
|||
|
Exit;
|
|||
|
PrtData(CDS_MJID.fieldbyname('MJID').AsString);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.SpeedButton49Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel3.Visible := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.APIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
InitLCK();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.Edit1Click(Sender: TObject);
|
|||
|
var
|
|||
|
i: Integer;
|
|||
|
begin
|
|||
|
Panel3.Visible := True;
|
|||
|
with Panel3 do
|
|||
|
begin
|
|||
|
for i := 0 to ControlCount - 1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TSpeedButton then
|
|||
|
begin
|
|||
|
TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.Edit2Change(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue: Double;
|
|||
|
begin
|
|||
|
if Trim(Edit1.Text) <> '' then
|
|||
|
begin
|
|||
|
if TryStrToFloat(Edit1.Text, mvalue) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Trim(Edit2.Text) <> '' then
|
|||
|
begin
|
|||
|
if TryStrToFloat(Edit2.Text, mvalue) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
CDQty.Text := FloatToStr(StrToFloat(Edit2.Text) - StrToFloat(Edit1.Text));
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.MJstr3KeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
Key := #0;
|
|||
|
SelectNext(ActiveControl as TWinControl, True, True);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.Label9Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if trim(Label9.Caption) = 'M' then
|
|||
|
begin
|
|||
|
Label9.Caption := 'Y';
|
|||
|
Label20.Caption := 'Y';
|
|||
|
Label7.Caption := 'Y';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Label9.Caption := 'M';
|
|||
|
Label20.Caption := 'M';
|
|||
|
Label7.Caption := 'M';
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.Button2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
RadioGroup1.ItemIndex := -1;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.APIDClick(Sender: TObject);
|
|||
|
var
|
|||
|
i: Integer;
|
|||
|
begin
|
|||
|
Panel3.Visible := True;
|
|||
|
with Panel3 do
|
|||
|
begin
|
|||
|
for i := 0 to ControlCount - 1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TSpeedButton then
|
|||
|
begin
|
|||
|
TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.Edit7Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Trim(Edit7.Text) = '' then
|
|||
|
begin
|
|||
|
Edit7.Text := '<27><>';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Edit7.Text := '';
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.MJQty4KeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
BTPrint.Click;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
IsCommopen := false;
|
|||
|
IsJsMessage := false;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.MJQty2Change(Sender: TObject);
|
|||
|
var
|
|||
|
FReal: double;
|
|||
|
begin
|
|||
|
// MJLen.Text:=format('%.1f',[StrToFloatdef(trim(MJLen.Text),0)- StrToFloatdef(trim(MJQty2.Text),0)]);
|
|||
|
{ IF trim(MKXS.Text)<>'' then
|
|||
|
begin
|
|||
|
if TryStrToFloat(MKXS.Text,FReal)=true then
|
|||
|
begin
|
|||
|
// MJLen.Text:=format('%.1f',[StrToFloatdef(trim(MJQty4.Text),0)* StrToFloatdef(trim(MKXS.Text),0)]);
|
|||
|
MJLen.Text:=format('%.1f',[StrToFloatdef(trim(MJLen.Text),0)- StrToFloatdef(trim(MJQty2.Text),0)]);
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if Trim(MJSJKZ.Text)='' then Exit;
|
|||
|
if TryStrToFloat(MJSJKZ.Text,FReal)=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Trim(MJFK.Text)='' then Exit;
|
|||
|
if TryStrToFloat(MJFK.Text,FReal)=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if StrToFloat(MJSJKZ.Text)*StrToFloat(MJFK.Text)=0 then Exit;
|
|||
|
if Trim(Label9.Caption)='M' then
|
|||
|
begin
|
|||
|
//MJLen.Text:=FloatToStr(StrToFloat(MJQty4.Text)*1000*100/StrToFloat(MJSJKZ.Text)/StrToFloat(MJFK.Text));
|
|||
|
MJLen.Text:=format('%.1f',[StrToFloat(MJQty4.Text)*1000*100/StrToFloat(MJSJKZ.Text)/StrToFloat(MJFK.Text)]);
|
|||
|
MJLen.Text:=format('%.1f',[StrToFloatdef(trim(MJLen.Text),0)- StrToFloatdef(trim(MJQty2.Text),0)]);
|
|||
|
end else
|
|||
|
begin
|
|||
|
MJLen.Text:=format('%.1f',[StrToFloat(MJQty4.Text)*1000*100/StrToFloat(MJSJKZ.Text)/StrToFloat(MJFK.Text)*1.0936]);
|
|||
|
MJLen.Text:=format('%.1f',[StrToFloatdef(trim(MJLen.Text),0)- StrToFloatdef(trim(MJQty2.Text),0)]);
|
|||
|
//MJLen.Text:=FloatToStr(StrToFloat(MJQty4.Text)*1000*100/StrToFloat(MJSJKZ.Text)/StrToFloat(MJFK.Text)*1.0936);
|
|||
|
// MJLen.Text:=floatToStr(Round(StrToFloat(MJQty4.Text)*1000*100/StrToFloat(MJSJKZ.Text)/StrToFloat(MJFK.Text)*1.0936));
|
|||
|
end;
|
|||
|
end; }
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.Edit8Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Trim(Edit8.Text) = '' then
|
|||
|
begin
|
|||
|
Edit8.Text := '<27><>';
|
|||
|
Button5.Visible := true;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Edit8.Text := '';
|
|||
|
Button5.Visible := false;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTableInspection.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|