890 lines
22 KiB
ObjectPascal
890 lines
22 KiB
ObjectPascal
unit U_WireInspection;
|
||
|
||
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, IniFiles, Menus, cxButtonEdit, cxLookAndFeels,
|
||
cxLookAndFeelPainters, cxNavigator;
|
||
|
||
type
|
||
TfrmWireInspection = class(TForm)
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
DataSource1: TDataSource;
|
||
Order_MJ: TClientDataSet;
|
||
ADOCmd: TADOQuery;
|
||
RMDB_Main: TRMDBDataSet;
|
||
RM2: TRMGridReport;
|
||
DS_MJCD: TDataSource;
|
||
CDS_MJCD: TClientDataSet;
|
||
DS_MJID: TDataSource;
|
||
CDS_MJID: TClientDataSet;
|
||
ADOQueryPrint: TADOQuery;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
ADOQueryMainDSC: TADOQuery;
|
||
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;
|
||
Panel7: TPanel;
|
||
RM3: TRMGridReport;
|
||
ADOTmp: TADOQuery;
|
||
Panel5: TPanel;
|
||
ToolBar1: TToolBar;
|
||
ToolButton1: TToolButton;
|
||
TBClose: TToolButton;
|
||
cxGrid3: TcxGrid;
|
||
Tv3: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
v3Column2: TcxGridDBColumn;
|
||
v3Column3: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
CDS_LSNO: TClientDataSet;
|
||
DataSource2: TDataSource;
|
||
Panel6: TPanel;
|
||
btnSampleSel: TButton;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
OrdNote: TRichEdit;
|
||
Panel2: TPanel;
|
||
Label5: TLabel;
|
||
Label3: TLabel;
|
||
JYGW: TEdit;
|
||
BTPrint: TButton;
|
||
XNO: TEdit;
|
||
Button6: TButton;
|
||
v3Column1: TcxGridDBColumn;
|
||
Label26: TLabel;
|
||
Label34: TLabel;
|
||
Edit6: TEdit;
|
||
ComboBox1: TComboBox;
|
||
Button5: TButton;
|
||
Label4: TLabel;
|
||
ZXZL: TEdit;
|
||
Label6: TLabel;
|
||
ZGZL: TEdit;
|
||
Button1: TButton;
|
||
Label7: TLabel;
|
||
KS: TEdit;
|
||
Label8: TLabel;
|
||
YRNo: TEdit;
|
||
Button3: TButton;
|
||
YRWeight: TEdit;
|
||
v3Column4: TcxGridDBColumn;
|
||
v3Column5: TcxGridDBColumn;
|
||
v3Column6: TcxGridDBColumn;
|
||
v3Column7: TcxGridDBColumn;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure BTPrintClick(Sender: TObject);
|
||
procedure SpeedButton1Click(Sender: TObject);
|
||
procedure SpeedButton12Click(Sender: TObject);
|
||
procedure cxGridDBColumn2PropertiesChange(Sender: TObject);
|
||
procedure Button5Click(Sender: TObject);
|
||
procedure SpeedButton49Click(Sender: TObject);
|
||
procedure KSClick(Sender: TObject);
|
||
procedure Edit6Click(Sender: TObject);
|
||
procedure MJstr3KeyPress(Sender: TObject; var Key: Char);
|
||
procedure ScanClick(Sender: TObject);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure btnSampleSelClick(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure v3Column9PropertiesEditValueChanged(Sender: TObject);
|
||
procedure v3Column5PropertiesEditValueChanged(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
FFFMJID, FOperationStatus, ZJmaxno: string;
|
||
FMainId, FSubId, FMJCode, FMJName, FMJColor, FMJSpec, FMJBatchNo, FMJZGZL, FMJZXZL, FMJFactoryName: string; // <20><>Ʒ<EFBFBD><C6B7>Ϣ
|
||
|
||
isCommopen, IsJsMessage: boolean;
|
||
procedure InitInspectionRecord(); //ˢ<>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||
function CheckData(CKType: string): Boolean; //У<><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
function SaveData(): Boolean; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
procedure ScanOrder(); //ɨ<>趩<EFBFBD><E8B6A9>
|
||
|
||
procedure ClearGlobal(MStatus: string); //<2F><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>ID
|
||
procedure PrintCKMDG(MRKOrdID: string); //<2F><>ӡ<EFBFBD><D3A1><EFBFBD>ⵥ
|
||
procedure PrtData(FMJID: string); //<2F><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>ǩ
|
||
procedure OpenCom(DllName: string);
|
||
procedure CloseCom(DllName: string);
|
||
procedure On1201(var Message: Tmessage); message 1201;
|
||
procedure On1301(var Message: Tmessage); message 1301;
|
||
public
|
||
fmanage,SMainId: string;
|
||
{ Public declarations }
|
||
|
||
end;
|
||
|
||
var
|
||
frmWireInspection: TfrmWireInspection;
|
||
newh, newh1: hwnd;
|
||
IniFile: TIniFile;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_Fun, U_ZDYHelp, U_iniParam, U_SCPerson, U_CPSel,U_LSSCListSel,
|
||
U_YarnRack;
|
||
|
||
{$R *.dfm}
|
||
|
||
function TfrmWireInspection.CheckData(CKType: string): Boolean;
|
||
var
|
||
mvalue: Double;
|
||
begin
|
||
try
|
||
if ((Trim(FMainId) = '') and (Trim(FMJCode) = '')) then
|
||
raise Exception.Create('<27><>ѡ<EFBFBD><D1A1><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>');
|
||
|
||
if Trim(CKType) = '<27>ύ' then
|
||
begin
|
||
if Trim(XNO.Text) = '' then
|
||
raise Exception.Create('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
|
||
if Trim(YRNo.Text) = '' then
|
||
raise Exception.Create('ɴ<>ܺŲ<DCBA><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
if StrToFloatdef(trim(YRWeight.Text), 0) = 0 then
|
||
raise Exception.Create('ɴ<><C9B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
if StrToFloatdef(trim(JYGW.Text), 0) = 0 then
|
||
raise Exception.Create('<27><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
if StrToFloatdef(trim(ZXZL.Text), 0) = 0 then
|
||
raise Exception.Create('ֽ<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
if StrToFloatdef(trim(ZGZL.Text), 0) = 0 then
|
||
raise Exception.Create('ֽ<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
end;
|
||
Result := True;
|
||
except
|
||
Result := false;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWireInspection.ClearGlobal(MStatus: string);
|
||
begin
|
||
if MStatus = 'ɨ<><C9A8>' then
|
||
begin
|
||
|
||
FMainId := '';
|
||
FSubId := '';
|
||
FFFMJID := '';
|
||
FMJCode := '';
|
||
|
||
JYGW.Text := '';
|
||
end;
|
||
|
||
if MStatus = '<27>ύ' then
|
||
begin
|
||
JYGW.Text := '';
|
||
FOperationStatus := '';
|
||
FFFMJID := '';
|
||
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmWireInspection.PrintCKMDG(MRKOrdID: 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_RKMDGangNo ');
|
||
SQL.Add(' @RKOrdID=''' + Trim(MRKOrdID) + '''');
|
||
Open;
|
||
end;
|
||
try
|
||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||
Txt := Trim(ADOQueryPrint.fieldbyname('RKOrdID').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><E9B2BC><EFBFBD>ֿ<EFBFBD><D6BF>뵥.rmf', ADOTmp);
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C>鲼<EFBFBD><E9B2BC><EFBFBD>ֿ<EFBFBD><D6BF>뵥.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RMVariables['QRBARCODE'] := fImagePath;
|
||
RM2.LoadFromFile(fPrintFile);
|
||
Rm2.DefaultCopies := 1;
|
||
RM2.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWireInspection.ScanOrder();
|
||
begin
|
||
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.* from YT_Plan_Main A');
|
||
sql.Add(' where isnull(Status,''0'')=''1'' ');
|
||
sql.Add(' and MainId=''' + Trim(SMainId) + ''' ');
|
||
|
||
Open;
|
||
end;
|
||
|
||
if not ADOTmp.IsEmpty then
|
||
begin
|
||
FMainId := Trim(ADOTmp.fieldbyname('MainId').AsString);
|
||
FMJCode := Trim(ADOTmp.fieldbyname('Y_Code').AsString);
|
||
FMJName := Trim(ADOTmp.fieldbyname('Y_CodeName').AsString);
|
||
FMJSpec := Trim(ADOTmp.fieldbyname('Y_Spec').AsString);
|
||
FMJBatchNo := Trim(ADOTmp.fieldbyname('BatchNo').AsString);
|
||
FMJZGZL := Trim(ADOTmp.fieldbyname('ZGZL').AsString);
|
||
FMJZXZL := Trim(ADOTmp.fieldbyname('ZXZL').AsString);
|
||
FMJFactoryName := Trim(ADOTmp.fieldbyname('FactoryName').AsString);
|
||
|
||
OrdNote.Text := '<27><>Ӧ<EFBFBD><D3A6>:' + FMJFactoryName + #13;
|
||
OrdNote.Text := OrdNote.Text + 'Ʒ<><C6B7>:' + FMJName + #13;
|
||
OrdNote.Text := OrdNote.Text + '<27><><EFBFBD><EFBFBD>:' + FMJSpec + #13;
|
||
OrdNote.Text := OrdNote.Text + '<27><><EFBFBD><EFBFBD>:' + FMJBatchNo + #13;
|
||
OrdNote.Text := OrdNote.Text + 'ֽ<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:' + FMJZGZL + #13;
|
||
OrdNote.Text := OrdNote.Text + 'ֽ<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:' + FMJZXZL + #13;
|
||
|
||
ZGZL.Text := FMJZGZL;
|
||
ZXZL.Text := FMJZXZL;
|
||
end
|
||
else
|
||
begin
|
||
ClearGlobal('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>');
|
||
end;
|
||
|
||
InitInspectionRecord();
|
||
|
||
|
||
end;
|
||
|
||
procedure TfrmWireInspection.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 TfrmWireInspection.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 TfrmWireInspection.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmWireInspection := nil;
|
||
end;
|
||
|
||
procedure TfrmWireInspection.On1301(var Message: Tmessage);
|
||
begin
|
||
|
||
end;
|
||
|
||
procedure TfrmWireInspection.On1201(var Message: Tmessage);
|
||
begin
|
||
|
||
end;
|
||
|
||
procedure TfrmWireInspection.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmWireInspection.InitInspectionRecord();
|
||
begin
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select A.*');
|
||
sql.Add('from JY_YT A where mainid=''' + trim(FMainId) + ''' ');
|
||
|
||
sql.Add(' and DATEDIFF(HH,Filltime,GETDATE())<2');
|
||
sql.Add('order by A.filltime desc');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOTmp, CDS_MJID);
|
||
SInitCDSData20(ADOTmp, CDS_MJID);
|
||
|
||
end;
|
||
|
||
procedure TfrmWireInspection.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmWireInspection.FormShow(Sender: TObject);
|
||
begin
|
||
|
||
// if IsINIFile() then
|
||
// ReadINIFile()
|
||
// else
|
||
// WriteINIFile;
|
||
|
||
|
||
end;
|
||
|
||
function TfrmWireInspection.SaveData(): Boolean;
|
||
var
|
||
maxno, FMJID, BZID, strsql: string;
|
||
FMJLen: Double;
|
||
begin
|
||
|
||
FMJID := '';
|
||
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from JY_YT where JYId=''' + Trim(FMJID) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(FMJID) = '' then
|
||
begin
|
||
Append;
|
||
if GetLSNo(ADOTmp, maxno, 'T' + Trim(SCXFlag), 'JY_YT', 4, 1) = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
BTPrint.Enabled := True;
|
||
exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
maxno := Trim(FMJID);
|
||
Edit;
|
||
end;
|
||
FieldByName('MainId').value := Trim(FMainId);
|
||
FieldByName('SubId').value := Trim(FSubId);
|
||
FieldByName('Y_Code').value := Trim(FMJCode);
|
||
FieldByName('Y_CodeName').value := Trim(FMJName);
|
||
FieldByName('Y_Color').value := Trim(FMJColor);
|
||
FieldByName('Y_Spec').value := Trim(FMJSpec);
|
||
FieldByName('BatchNo').value := Trim(FMJBatchNo);
|
||
FieldByName('JYID').Value := Trim(maxno);
|
||
FieldByName('CRType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
|
||
FieldByName('Valie').Value := 'Y';
|
||
FieldByName('XNO').Value := Trim(XNO.Text);
|
||
FieldByName('YRNo').Value := Trim(YRNo.Text);
|
||
FieldByName('YRWeight').Value := StrToFloatdef(trim(YRWeight.Text), 0);
|
||
FieldByName('JYGW').Value := StrToFloatdef(trim(JYGW.Text), 0); //<2F><><EFBFBD><EFBFBD>
|
||
FieldByName('ZXZL').Value := StrToFloatdef(trim(ZXZL.Text), 0);
|
||
FieldByName('ZGZL').Value := StrToFloatdef(trim(ZGZL.Text), 0);
|
||
if Trim(FMJID) = '' then
|
||
begin
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('FillCode').Value := Trim(DCode);
|
||
FieldByName('FillTime').Value := SGetServerDateTime(ADOTmp);
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('EditCode').Value := Trim(DCode);
|
||
FieldByName('EditTime').Value := SGetServerDateTime(ADOTmp);
|
||
end;
|
||
FieldByName('JTType').Value := Trim(SCXFlag);
|
||
Post;
|
||
end;
|
||
FMJID := trim(maxno);
|
||
FFFMJID := FMJID;
|
||
|
||
////////////////////////<2F><><EFBFBD><EFBFBD><EFBFBD>⼰<EFBFBD><E2BCB0><EFBFBD><EFBFBD>/////////////////////////////////////
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_JY_Insert_YT @JYID=''' + trim(FMJID) + '''');
|
||
execsql;
|
||
end;
|
||
////////////////////////<2F><><EFBFBD><EFBFBD><EFBFBD>⼰<EFBFBD><E2BCB0><EFBFBD><EFBFBD>/////////////////////////////////////
|
||
|
||
ADOCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
Result := False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
BTPrint.Enabled := True;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWireInspection.BTPrintClick(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
mvalue: Double;
|
||
i: Integer;
|
||
begin
|
||
BTPrint.Enabled := False;
|
||
XNO.SetFocus;
|
||
if CheckData('<27>ύ') = False then
|
||
begin
|
||
BTPrint.Enabled := True;
|
||
exit;
|
||
end;
|
||
if JYGW.Text = '' then
|
||
begin
|
||
BTPrint.Enabled := True;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if GetLSNo(ADOTmp, ZJmaxno, 'ZJ', 'JY_YT', 3, 1) = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
BTPrint.Enabled := True;
|
||
exit;
|
||
end;
|
||
for i := 1 to StrToInt(KS.Text) do
|
||
begin
|
||
|
||
if SaveData() then
|
||
begin
|
||
|
||
PrtData(FFFMJID);
|
||
|
||
end
|
||
else
|
||
begin
|
||
BTPrint.Enabled := True;
|
||
end;
|
||
sleep(200);
|
||
end;
|
||
|
||
InitInspectionRecord();
|
||
|
||
ClearGlobal('<27>ύ');
|
||
|
||
KSClick(JYGW);
|
||
BTPrint.Enabled := True;
|
||
end;
|
||
|
||
procedure TfrmWireInspection.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_JY_Print_YTLab ');
|
||
SQL.Add(' @JYID=''' + 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);
|
||
BTPrint.Enabled := True;
|
||
exit;
|
||
end;
|
||
try
|
||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||
Txt := Trim(ADOQueryPrint.fieldbyname('JYID').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);
|
||
BTPrint.Enabled := True;
|
||
exit;
|
||
end;
|
||
|
||
ExportFtErpFile(Trim('<27>ӵ<EFBFBD><D3B5><EFBFBD>ǩ.rmf'), ADOTmp);
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C>ӵ<EFBFBD><D3B5><EFBFBD>ǩ.rmf';
|
||
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RMVariables['QRBARCODE'] := fImagePath;
|
||
RM2.LoadFromFile(fPrintFile);
|
||
Rm2.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1);
|
||
RM2.PrintReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWireInspection.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 TfrmWireInspection.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 TfrmWireInspection.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 TfrmWireInspection.Button5Click(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
i: Integer;
|
||
mvalue: Double;
|
||
begin
|
||
if CDS_MJID.IsEmpty then
|
||
Exit;
|
||
PrtData(CDS_MJID.fieldbyname('LSID').AsString);
|
||
end;
|
||
|
||
procedure TfrmWireInspection.SpeedButton49Click(Sender: TObject);
|
||
begin
|
||
Panel3.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmWireInspection.KSClick(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 TfrmWireInspection.Edit6Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit6.Text) = '' then
|
||
begin
|
||
Edit6.Text := '<27><>';
|
||
end
|
||
else
|
||
begin
|
||
Edit6.Text := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWireInspection.MJstr3KeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
Key := #0;
|
||
SelectNext(ActiveControl as TWinControl, True, True);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWireInspection.ScanClick(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 TfrmWireInspection.FormCreate(Sender: TObject);
|
||
begin
|
||
IsCommopen := false;
|
||
IsJsMessage := false;
|
||
end;
|
||
|
||
procedure TfrmWireInspection.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 TfrmWireInspection.btnSampleSelClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmLSSCListSel:=TfrmLSSCListSel.Create(Self);
|
||
with frmLSSCListSel do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
SMainId:=Trim(FMainid);
|
||
end;
|
||
end;
|
||
finally
|
||
frmLSSCListSel.close;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWireInspection.N1Click(Sender: TObject);
|
||
begin
|
||
if CDS_MJID.IsEmpty then
|
||
Exit;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update jy_ls set zjstatus=''<27>ʼ<EFBFBD>'',ZJTime=getdate(),ZJPerson=''' + trim(DName) + ''' ');
|
||
sql.Add('where lsid=''' + trim(CDS_MJID.fieldbyname('lsid').AsString) + ''' ');
|
||
ExecSQl;
|
||
end;
|
||
PrtData(CDS_MJID.fieldbyname('LSID').AsString);
|
||
InitInspectionRecord();
|
||
end;
|
||
|
||
procedure TfrmWireInspection.N2Click(Sender: TObject);
|
||
begin
|
||
if CDS_MJID.IsEmpty then
|
||
Exit;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update jy_ls set zjstatus=''<27>ʼ<EFBFBD>'',ZJTime=getdate(),ZJPerson=''' + trim(DName) + ''' ');
|
||
sql.Add('where zjno=''' + trim(CDS_MJID.fieldbyname('zjno').AsString) + ''' ');
|
||
ExecSQl;
|
||
end;
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from jy_ls where zjno=''' + trim(CDS_MJID.fieldbyname('zjno').AsString) + ''' ');
|
||
Open;
|
||
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
PrtData(ADOCmd.fieldbyname('LSID').AsString);
|
||
Next;
|
||
end;
|
||
|
||
end;
|
||
|
||
InitInspectionRecord();
|
||
end;
|
||
|
||
procedure TfrmWireInspection.v3Column9PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalues: string;
|
||
begin
|
||
mvalues := TCXTextEdit(Sender).Text;
|
||
|
||
with CDS_MJID do
|
||
begin
|
||
edit;
|
||
fieldbyname('LSKZ').Value := mvalues;
|
||
post;
|
||
end;
|
||
tv3.Controller.EditingController.ShowEdit();
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update JY_LS Set LSKZ=''' + trim(mvalues) + ''' ');
|
||
sql.Add('where LSID=''' + Trim(CDS_MJID.fieldbyname('LSID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmWireInspection.v3Column5PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalues: string;
|
||
begin
|
||
mvalues := TCXTextEdit(Sender).Text;
|
||
|
||
with CDS_MJID do
|
||
begin
|
||
edit;
|
||
fieldbyname('LSLen2').Value := mvalues;
|
||
post;
|
||
end;
|
||
tv3.Controller.EditingController.ShowEdit();
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update JY_LS Set LSLen2=''' + trim(mvalues) + ''' ');
|
||
sql.Add('where LSID=''' + Trim(CDS_MJID.fieldbyname('LSID').AsString) + '''');
|
||
sql.Add('Update CK_LS_CR Set LSLen2=''' + trim(mvalues) + ''' ');
|
||
sql.Add('where LSID=''' + Trim(CDS_MJID.fieldbyname('LSID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmWireInspection.Button1Click(Sender: TObject);
|
||
var
|
||
maxno: string;
|
||
begin
|
||
if GetLSNo(ADOTmp, maxno, 'X', 'JY_YT', 3, 1) = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
|
||
exit;
|
||
end;
|
||
XNO.Text := maxno;
|
||
end;
|
||
|
||
end.
|
||
|