1237 lines
32 KiB
ObjectPascal
1237 lines
32 KiB
ObjectPascal
unit U_SJLBInspection;
|
||
|
||
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, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore, dxSkinBlack,
|
||
dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom,
|
||
dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
|
||
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
|
||
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
||
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
||
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
||
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
||
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
|
||
dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
|
||
dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
|
||
dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinsDefaultPainters,
|
||
dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue,
|
||
dxSkinscxPCPainter, cxNavigator;
|
||
{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
|
||
TfrmSJLBnspection = 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;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
ADOQueryMainDSC: TADOQuery;
|
||
Panel2: TPanel;
|
||
Label9: TLabel;
|
||
MJLen: TEdit;
|
||
Label4: TLabel;
|
||
MJMaoZ: TEdit;
|
||
Label5: TLabel;
|
||
Label11: TLabel;
|
||
BTPrint: 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;
|
||
RM3: TRMGridReport;
|
||
ADOTmp: TADOQuery;
|
||
Panel5: TPanel;
|
||
Panel6: TPanel;
|
||
Label1: TLabel;
|
||
Label35: TLabel;
|
||
Label39: TLabel;
|
||
APID: TEdit;
|
||
Edit7: TEdit;
|
||
Edit8: TEdit;
|
||
ToolBar1: TToolBar;
|
||
ToolButton1: TToolButton;
|
||
TBCD: TToolButton;
|
||
TBClose: TToolButton;
|
||
Label36: TLabel;
|
||
mjxh: TEdit;
|
||
Label2: TLabel;
|
||
lblOrderNo: TLabel;
|
||
Label3: TLabel;
|
||
Label6: TLabel;
|
||
Label7: TLabel;
|
||
Label8: TLabel;
|
||
Label10: TLabel;
|
||
Button1: TButton;
|
||
Button2: TButton;
|
||
Tv3Column1: TcxGridDBColumn;
|
||
Label12: TLabel;
|
||
gx: TComboBox;
|
||
Button3: TButton;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
|
||
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 BTPrintClick(Sender: TObject);
|
||
procedure Tv2CDQtyPropertiesEditValueChanged(Sender: TObject);
|
||
procedure SpeedButton1Click(Sender: TObject);
|
||
procedure SpeedButton12Click(Sender: TObject);
|
||
procedure SpeedButton13Click(Sender: TObject);
|
||
procedure cxGridDBColumn2PropertiesChange(Sender: TObject);
|
||
|
||
procedure SpeedButton49Click(Sender: TObject);
|
||
procedure APIDKeyPress(Sender: TObject; var Key: Char);
|
||
procedure Edit1Click(Sender: TObject);
|
||
|
||
procedure MJstr3KeyPress(Sender: TObject; var Key: Char);
|
||
|
||
procedure APIDClick(Sender: TObject);
|
||
procedure Edit7Click(Sender: TObject);
|
||
procedure MJQty4KeyPress(Sender: TObject; var Key: Char);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure MJQty2Change(Sender: TObject);
|
||
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure Button2Click(Sender: TObject);
|
||
procedure Button3Click(Sender: TObject);
|
||
|
||
private
|
||
{ Private declarations }
|
||
FInt, PState, PrintInt, SCInitGrid, FState, FCK: Integer;
|
||
FColumn, FAPID, FMainId, FSubId, FFFMJID, FYXJL, FMBMXID: string;
|
||
MValue, FCDName: string;
|
||
FDBKCID, FDB, FMBKCID, FMB: string;
|
||
isCommopen, IsJsMessage: boolean;
|
||
fxsType, fRollType: string;
|
||
|
||
procedure InitCDGrid();
|
||
procedure InitCDGridID();
|
||
function SaveData(MMJType: string): Boolean;
|
||
procedure InitLCK(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD>
|
||
procedure InitDB(); //<2F><><EFBFBD>صײ<D8B5>
|
||
procedure InitMB(); //<2F><><EFBFBD><EFBFBD><EFBFBD>沼
|
||
procedure InitDBMX(); //<2F><><EFBFBD>صײ<D8B5><D7B2><EFBFBD>ϸ
|
||
procedure ClearGlobal(); //<2F><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>ID
|
||
function CheckData(CKType: string): Boolean;
|
||
|
||
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;
|
||
fFlileFlag: string;
|
||
{ Public declarations }
|
||
|
||
end;
|
||
|
||
var
|
||
frmSJLBnspection: TfrmSJLBnspection;
|
||
newh, newh1: hwnd;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_Fun, U_ZDYHelp, U_iniParam, U_ProductOrderListSel, getpic2; //
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmSJLBnspection.ClearGlobal();
|
||
begin
|
||
FAPID := '';
|
||
FMainId := '';
|
||
FSubId := '';
|
||
lblOrderNo.Caption := '<27><><EFBFBD>̿<EFBFBD><CCBF><EFBFBD>';
|
||
|
||
APID.SetFocus;
|
||
end;
|
||
|
||
function TfrmSJLBnspection.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(CKType) = '<27>ύ' then
|
||
begin
|
||
|
||
if trim(Label9.Caption) = '' then
|
||
raise Exception.Create('<27><><EFBFBD>ȵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
|
||
|
||
if Trim(MJMaoZ.Text) <> '' then
|
||
begin
|
||
|
||
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 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 TfrmSJLBnspection.InitDBMX();
|
||
begin
|
||
//<2F>ǵø<C7B5>10
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.* ');
|
||
sql.Add(',maxRoll=1+isnull((select cast (max(XH) as int) from JYOrder_DBKC_MX X where ISNULL(X.DBKCID,'''')=ISNULL(A.DBKCID,'''') AND X.CARNO=A.CARNO ),0)');
|
||
|
||
SQL.Add(' FROM JYOrder_DBKC_MX A WHERE DBKCID= ''' + Trim(FDBKCID) + '''');
|
||
SQL.Add('AND CARNO= ''' + Trim(FAPID) + '''');
|
||
// ShowMessage(SQL.Text);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOTmp, CDS_MJID);
|
||
SInitCDSData20(ADOTmp, CDS_MJID);
|
||
if ADOTmp.IsEmpty then
|
||
begin
|
||
MJXH.Text := '1';
|
||
end
|
||
else
|
||
begin
|
||
MJXH.Text := ADOTmp.FIELDBYNAME('maxRoll').AsString;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.InitLCK();
|
||
begin
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.* FROM JYORDER_CAR A WHERE CARNO= ''' + Trim(APID.Text) + '''');
|
||
|
||
Open;
|
||
end;
|
||
if ADOTmp.IsEmpty = False then
|
||
begin
|
||
FAPID := Trim(ADOTmp.FIELDBYNAME('CARNO').AsString);
|
||
FMainId := Trim(ADOTmp.FIELDBYNAME('MAINID').AsString);
|
||
FSUBId := Trim(ADOTmp.FIELDBYNAME('SUBID').AsString);
|
||
APID.Text := '';
|
||
FDBKCID := '';
|
||
FDB := '';
|
||
LABEL8.Caption := '';
|
||
LABEL7.Caption := Trim(ADOTmp.fieldbyname('CARNO').AsString);
|
||
|
||
APID.SetFocus;
|
||
|
||
end
|
||
else
|
||
begin
|
||
ClearGlobal();
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.InitDB();
|
||
begin
|
||
if FAPID = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_PB_CR A INNER JOIN JYOrder_DBKC B ON A.CRID=B.KCID WHERE MAINID= ''' + Trim(FMAINID) + '''');
|
||
SQL.Add('AND CRID=''' + Trim(APID.Text) + '''');
|
||
Open;
|
||
end;
|
||
if ADOTmp.IsEmpty = False then
|
||
begin
|
||
// FAPID := Trim(ADOTmp.FIELDBYNAME('CARNO').AsString);
|
||
// FMainId := Trim(ADOTmp.FIELDBYNAME('MAINID').AsString);
|
||
FDBKCID := Trim(ADOTmp.FIELDBYNAME('DBKCID').AsString);
|
||
FDB := Trim(ADOTmp.FIELDBYNAME('KCID').AsString);
|
||
APID.Text := '';
|
||
|
||
LABEL8.Caption := Trim(ADOTmp.fieldbyname('CRID').AsString);
|
||
|
||
APID.SetFocus;
|
||
InitDBMX();
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ײ<F3B6A8B5><D7B2><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
APID.Text := '';
|
||
Exit;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.InitMB();
|
||
begin
|
||
if FAPID = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD>!', '<27><>ʾ', 0);
|
||
APID.Text := '';
|
||
Exit;
|
||
end;
|
||
if FDBKCID = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD>ײ<EFBFBD><D7B2><EFBFBD>!', '<27><>ʾ', 0);
|
||
APID.Text := '';
|
||
Exit;
|
||
end;
|
||
if LABEL10.Caption <> '' then
|
||
begin
|
||
Button1.Click();
|
||
end;
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_PB_CR A INNER JOIN JYOrder_PBKC B ON A.CRID=B.KCID INNER JOIN CK_SXPB_CRMX C ON A.CRID=C.CRNO ');
|
||
SQL.ADD(' WHERE MAINID= ''' + Trim(FMAINID) + '''');
|
||
SQL.Add('AND MJID=''' + Trim(APID.Text) + '''');
|
||
Open;
|
||
end;
|
||
if ADOTmp.IsEmpty = False then
|
||
begin
|
||
// FAPID := Trim(ADOTmp.FIELDBYNAME('CARNO').AsString);
|
||
// FMainId := Trim(ADOTmp.FIELDBYNAME('MAINID').AsString);
|
||
|
||
FMBKCID := Trim(ADOTmp.FIELDBYNAME('PBKCID').AsString);
|
||
FMB := Trim(ADOTmp.FIELDBYNAME('KCID').AsString);
|
||
FMBMXID := Trim(ADOTmp.FIELDBYNAME('MJID').AsString);
|
||
APID.Text := '';
|
||
|
||
LABEL10.Caption := Trim(ADOTmp.fieldbyname('MJID').AsString);
|
||
|
||
APID.SetFocus;
|
||
|
||
// /
|
||
// InitDBMX();
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>沼<EFBFBD><E6B2BC><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
APID.Text := '';
|
||
Exit;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.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 TfrmSJLBnspection.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 TfrmSJLBnspection.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmSJLBnspection := nil;
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.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 TfrmSJLBnspection.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 TfrmSJLBnspection.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
//DataLink_WFBProducttion.ADOLink.Connected:=False;
|
||
|
||
if isCommopen then
|
||
begin
|
||
closeCom(DllName);
|
||
closeCom(JCYDLL);
|
||
end;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.InitCDGrid();
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from CK_SXPB_CRMX_CD where MJID='''' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, CDS_MJCD);
|
||
SInitCDSData20(ADOQueryMain, CDS_MJCD);
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.InitCDGridID();
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select A.*');
|
||
sql.Add('from CK_SXPB_CRMX A where CRNO=''' + Trim(FAPID) + '''');
|
||
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, CDS_MJID);
|
||
SInitCDSData20(ADOQueryMain, CDS_MJID);
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.FormShow(Sender: TObject);
|
||
begin
|
||
fFlileFlag := UserDataFlag + 'HX';
|
||
if IsINIFile() then
|
||
ReadINIFile()
|
||
else
|
||
WriteINIFile;
|
||
if trim(Edit7.Text) = '<27><>' then
|
||
IsJsMessage := true;
|
||
|
||
if trim(fmanage) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
if trim(DllName) <> '' then
|
||
OpenCom(DllName);
|
||
if trim(JCYDLL) <> '' then
|
||
OpenCom(JCYDLL);
|
||
Edit7.Visible := true;
|
||
Label35.Visible := true;
|
||
end;
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from SY_User where username=' + QuotedStr(Trim(dname)));
|
||
Open;
|
||
end;
|
||
if ADOTmp.fieldbyname('UDEPT').asstring <> '' then
|
||
begin
|
||
gx.ItemIndex := gx.Items.IndexOf(trim(ADOTmp.fieldbyname('UDEPT').asstring));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.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 TfrmSJLBnspection.MJMaoZClick(Sender: TObject);
|
||
begin
|
||
FInt := 1;
|
||
FColumn := '';
|
||
panel3.Visible := True;
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.MJLenClick(Sender: TObject);
|
||
begin
|
||
FInt := 2;
|
||
FColumn := '';
|
||
panel3.Visible := True;
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
InitCDGridID();
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.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 TfrmSJLBnspection.FormClick(Sender: TObject);
|
||
begin
|
||
FInt := 4;
|
||
end;
|
||
|
||
function TfrmSJLBnspection.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 CK_SXPB_CRMX where 1=2');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Append;
|
||
if GetLSNo(ADOTmp, maxno, 'MX', 'CK_SXPB_CRMX', 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('CRNO').value := Trim(FAPID);
|
||
FieldByName('MJID').Value := Trim(maxno);
|
||
|
||
FieldByName('MJXH').Value := mjxh.Text;
|
||
|
||
FieldByName('MXQty2').Value := StrToFloatdef(trim(MJLen.Text), 0);
|
||
//ë<><C3AB>
|
||
FieldByName('MXQty').Value := StrToFloatdef(trim(MJMaoZ.Text), 0);
|
||
|
||
FieldByName('MF').Value := StrToFloatdef(trim(MJMaoZ.Text), 0);
|
||
FieldByName('KZ').Value := StrToFloatdef(trim(MJMaoZ.Text), 0);
|
||
if Trim(FMJID) = '' then
|
||
begin
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('FILLTIME').Value := SGetServerDateTime(ADOTmp);
|
||
end
|
||
else
|
||
begin
|
||
|
||
end;
|
||
|
||
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', 'CK_SXPB_CRMX_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 CK_SXPB_CRMX_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, 'CK_SXPB_CRMX_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;
|
||
|
||
//<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 TfrmSJLBnspection.BTPrintClick(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
mvalue: Double;
|
||
i: Integer;
|
||
begin
|
||
APID.SetFocus;
|
||
if CheckData('<27>ύ') = False then
|
||
exit;
|
||
if SaveData('') then
|
||
begin
|
||
MJLen.Text := '';
|
||
MJMaoZ.Text := '';
|
||
MJXH.Text := inttostr(strTointdef(trim(MJXH.Text), 0) + 1);
|
||
|
||
// if Trim(Edit6.Text) = '<27><>' then
|
||
// begin
|
||
// PrtData(FFFMJID);
|
||
// end;
|
||
end;
|
||
|
||
InitCDGridID();
|
||
InitCDGrid();
|
||
|
||
// if FYXJL = '<27><><EFBFBD><EFBFBD>' then
|
||
// begin
|
||
MJLen.SetFocus;
|
||
Edit1Click(MJLen);
|
||
// end
|
||
// else
|
||
// begin
|
||
// MJMaoZ.SetFocus;
|
||
// Edit1Click(MJMaoZ);
|
||
// end;
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.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 TfrmSJLBnspection.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 TfrmSJLBnspection.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 TfrmSJLBnspection.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;
|
||
|
||
//<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 TfrmSJLBnspection.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 TfrmSJLBnspection.SpeedButton49Click(Sender: TObject);
|
||
begin
|
||
Panel3.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.APIDKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
if (Pos('CZ', APID.Text) > 0) or (Pos('YK', APID.Text) > 0) then
|
||
begin
|
||
if FDBKCID <> '' then
|
||
begin
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select ZZ=ISNULL(SJKC,0) from JYOrder_DBKC where DBKCID=' + QuotedStr(Trim(FDBKCID)));
|
||
Open;
|
||
end;
|
||
if ADOTmp.FieldByName('ZZ').ASFLOAT = 0 then
|
||
begin
|
||
if Application.MessageBox('<27>õײ<C3B5><D7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>,<2C>Ƿ棿', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('UPDATE JYOrder_DBKC SET SJKC=' + (Trim(MJLen.Text)));
|
||
SQL.Add('WHERE DBKCID=' + QuotedStr(FDBKCID));
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
InitLCK();
|
||
InitDBMX();
|
||
end
|
||
else
|
||
begin
|
||
InitLCK();
|
||
InitDBMX();
|
||
end;
|
||
|
||
end;
|
||
if Pos('PR', APID.Text) > 0 then
|
||
begin
|
||
|
||
if FDBKCID <> '' then
|
||
begin
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select ZZ=ISNULL(SJKC,0) from JYOrder_DBKC where DBKCID=' + QuotedStr(Trim(FDBKCID)));
|
||
Open;
|
||
end;
|
||
if ADOTmp.FieldByName('ZZ').ASFLOAT = 0 then
|
||
begin
|
||
if Application.MessageBox('<27>õײ<C3B5><D7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>,<2C>Ƿ棿', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('UPDATE JYOrder_DBKC SET SJKC=' + (Trim(MJLen.Text)));
|
||
SQL.Add('WHERE DBKCID=' + QuotedStr(FDBKCID));
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
InitDB();
|
||
end
|
||
else
|
||
begin
|
||
InitDB();
|
||
end;
|
||
end;
|
||
if Pos('MX', APID.Text) > 0 then
|
||
begin
|
||
InitMB();
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.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 TfrmSJLBnspection.MJstr3KeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
Key := #0;
|
||
SelectNext(ActiveControl as TWinControl, True, True);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.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 TfrmSJLBnspection.Edit7Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit7.Text) = '' then
|
||
begin
|
||
Edit7.Text := '<27><>';
|
||
end
|
||
else
|
||
begin
|
||
Edit7.Text := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.MJQty4KeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
BTPrint.Click;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.FormCreate(Sender: TObject);
|
||
begin
|
||
IsCommopen := false;
|
||
IsJsMessage := false;
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.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 TfrmSJLBnspection.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.Button1Click(Sender: TObject);
|
||
var
|
||
maxno, FMJID, BZID, strsql: string;
|
||
FMJLen: Double;
|
||
FOrder: Integer;
|
||
begin
|
||
if gx.Text = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
if (gx.Text = '<27><><EFBFBD><EFBFBD>') and (Label8.Caption = '') then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from JYOrder_DBKC_MX where 1=2');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Append;
|
||
if GetLSNo(ADOTmp, maxno, 'DMX', 'JYOrder_DBKC_MX', 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('DBKCMXID').value := Trim(maxno);
|
||
FieldByName('DBKCID').value := Trim(FDBKCID);
|
||
FieldByName('MainId').value := Trim(FMainId);
|
||
FieldByName('SubId').value := Trim(FSubId);
|
||
FieldByName('KCId').value := Trim(FDB);
|
||
FieldByName('MBMXID').value := Trim(FMBMXID);
|
||
FieldByName('MBKCID').value := Trim(FMBKCID);
|
||
FieldByName('MBKC').value := Trim(FMB);
|
||
FieldByName('QTY').value := StrToFloatDef(MJLEN.TEXT, 0);
|
||
FieldByName('CARNO').value := FAPID;
|
||
FieldByName('GLIDENAME').value := gx.Text;
|
||
FieldByName('XH').Value := mjxh.Text;
|
||
|
||
if Trim(FMJID) = '' then
|
||
begin
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('FILLTIME').Value := SGetServerDateTime(ADOTmp);
|
||
end
|
||
else
|
||
begin
|
||
|
||
end;
|
||
|
||
Post;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear; //<2F>ǵø<C7B5><C3B8>Ƹ<EFBFBD>10
|
||
SQL.Add('UPDATE JYOrder_DBKC_MX SET SJQTY=QTY-ISNULL((SELECT ISNULL(QTY,0) FROM JYOrder_DBKC_MX E WHERE E.KCID=JYOrder_DBKC_MX.KCID AND E.CARNO=JYOrder_DBKC_MX.CARNO AND E.XH=(JYOrder_DBKC_MX.XH-1) ),0)');
|
||
SQL.Add('WHERE DBKCMXID=' + QuotedStr(Trim(maxno)));
|
||
ExecSQL;
|
||
end;
|
||
InitDBMX();
|
||
ADOCmd.Connection.CommitTrans;
|
||
Label10.Caption := '';
|
||
FMB := '';
|
||
FMBMXID := '';
|
||
FMBKCID := '';
|
||
PState := 0;
|
||
except
|
||
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.Button2Click(Sender: TObject);
|
||
begin
|
||
if FDBKCID <> '' then
|
||
begin
|
||
// Button1.Click();
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('UPDATE JYOrder_DBKC SET SJKC=' + (Trim(MJLen.Text)));
|
||
SQL.Add('WHERE DBKCID=' + QuotedStr(FDBKCID));
|
||
ExecSQL;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox('δɨ<CEB4><C9A8><EFBFBD>ײ<EFBFBD><D7B2><EFBFBD>', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmSJLBnspection.Button3Click(Sender: TObject);
|
||
begin
|
||
// FormGetPic2 := TFormGetPic2.create(self);
|
||
// with FormGetPic2 do
|
||
// begin
|
||
// fFlileFlag := self.fFlileFlag;
|
||
// FMainId := self.FAPID;
|
||
// fkeyNo := self.FAPID;
|
||
// FTFType := 'YP';
|
||
// pat1 := 'FileName';
|
||
// pic1 := 'FilesOther';
|
||
// if showmodal = 1 then
|
||
// begin
|
||
//// IMG_SLT.Text := trim(fkeyNo);
|
||
// end;
|
||
// free;
|
||
// end;
|
||
end;
|
||
|
||
end.
|
||
|