3136 lines
92 KiB
ObjectPascal
3136 lines
92 KiB
ObjectPascal
unit U_MJManageNewFDNew;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, StrUtils, 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, cxNavigator, 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;
|
||
{function CommOpen(fhandle:hwnd;sCommName:PAnsiChar;
|
||
IntTime:integer;IsMessage:integer):integer;stdcall;external 'JZCRS232U.DLL';
|
||
function CommClose(sCommName:PAnsiChar):integer;stdcall;external 'JZCRS232U.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
|
||
TfrmMJManageNewFDNewSF = class(TForm)
|
||
cxStyleRepository1: TcxStyleRepository;
|
||
cxStyle1: TcxStyle;
|
||
cxStyle2: TcxStyle;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
DataSource1: TDataSource;
|
||
Order_MJ: TClientDataSet;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOCmd: TADOQuery;
|
||
RMDBMain: 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;
|
||
SpeedButton14: TSpeedButton;
|
||
SpeedButton15: TSpeedButton;
|
||
SpeedButton16: TSpeedButton;
|
||
SpeedButton17: TSpeedButton;
|
||
SpeedButton18: TSpeedButton;
|
||
SpeedButton21: TSpeedButton;
|
||
SpeedButton22: TSpeedButton;
|
||
SpeedButton23: TSpeedButton;
|
||
SpeedButton24: TSpeedButton;
|
||
SpeedButton25: TSpeedButton;
|
||
SpeedButton26: TSpeedButton;
|
||
SpeedButton29: TSpeedButton;
|
||
SpeedButton30: TSpeedButton;
|
||
SpeedButton31: TSpeedButton;
|
||
SpeedButton32: TSpeedButton;
|
||
SpeedButton33: TSpeedButton;
|
||
SpeedButton34: TSpeedButton;
|
||
SpeedButton37: TSpeedButton;
|
||
SpeedButton38: TSpeedButton;
|
||
SpeedButton39: TSpeedButton;
|
||
SpeedButton40: TSpeedButton;
|
||
SpeedButton41: TSpeedButton;
|
||
SpeedButton42: TSpeedButton;
|
||
cxStyleRepository2: TcxStyleRepository;
|
||
cxStyle3: TcxStyle;
|
||
cxStyleRepository3: TcxStyleRepository;
|
||
cxStyle4: TcxStyle;
|
||
cxStyleRepository4: TcxStyleRepository;
|
||
cxStyle5: TcxStyle;
|
||
cxStyleRepository5: TcxStyleRepository;
|
||
cxStyle6: TcxStyle;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
ADOQueryMainDSC: TADOQuery;
|
||
SpeedButton45: TSpeedButton;
|
||
SpeedButton46: TSpeedButton;
|
||
SpeedButton47: TSpeedButton;
|
||
SpeedButton48: TSpeedButton;
|
||
SpeedButton50: TSpeedButton;
|
||
SpeedButton51: TSpeedButton;
|
||
SpeedButton54: TSpeedButton;
|
||
SpeedButton55: TSpeedButton;
|
||
SpeedButton56: TSpeedButton;
|
||
SpeedButton57: TSpeedButton;
|
||
SpeedButton58: TSpeedButton;
|
||
SpeedButton59: TSpeedButton;
|
||
SpeedButton62: TSpeedButton;
|
||
SpeedButton63: TSpeedButton;
|
||
SpeedButton64: TSpeedButton;
|
||
SpeedButton65: TSpeedButton;
|
||
SpeedButton66: TSpeedButton;
|
||
SpeedButton67: TSpeedButton;
|
||
SpeedButton70: TSpeedButton;
|
||
SpeedButton71: TSpeedButton;
|
||
SpeedButton72: TSpeedButton;
|
||
SpeedButton73: TSpeedButton;
|
||
SpeedButton74: TSpeedButton;
|
||
SpeedButton75: TSpeedButton;
|
||
Panel2: TPanel;
|
||
Label9: TLabel;
|
||
MJFK: TEdit;
|
||
Label3: TLabel;
|
||
MJLen: TEdit;
|
||
Label4: TLabel;
|
||
MJMaoZ: TEdit;
|
||
Label5: TLabel;
|
||
Label6: TLabel;
|
||
Label11: TLabel;
|
||
BTPrint: TButton;
|
||
Button5: TButton;
|
||
Edit3: TEdit;
|
||
Label10: TLabel;
|
||
Edit4: TEdit;
|
||
Label12: TLabel;
|
||
Label13: TLabel;
|
||
Label14: TLabel;
|
||
MJQty1: TEdit;
|
||
Label15: TLabel;
|
||
Label22: TLabel;
|
||
Label23: TLabel;
|
||
MJSJKZ: TEdit;
|
||
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;
|
||
Label27: TLabel;
|
||
MJQty2: TEdit;
|
||
Label28: TLabel;
|
||
Edit5: TEdit;
|
||
Label26: TLabel;
|
||
Edit6: TEdit;
|
||
Label29: TLabel;
|
||
MJstr3: TEdit;
|
||
Label30: TLabel;
|
||
MJQty3: TEdit;
|
||
Label31: TLabel;
|
||
Label32: TLabel;
|
||
MJQty4: TEdit;
|
||
Label33: TLabel;
|
||
Panel4: TPanel;
|
||
MovePanel1: TMovePanel;
|
||
Label17: TLabel;
|
||
Label18: TLabel;
|
||
Label19: TLabel;
|
||
Label20: TLabel;
|
||
Label21: TLabel;
|
||
Label7: TLabel;
|
||
Label8: TLabel;
|
||
Edit1: TEdit;
|
||
Button1: TButton;
|
||
Button4: TButton;
|
||
Edit2: TEdit;
|
||
CDQty: TEdit;
|
||
RadioGroup1: TRadioGroup;
|
||
Button2: TButton;
|
||
Panel5: TPanel;
|
||
Panel6: TPanel;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
Label16: TLabel;
|
||
Label24: TLabel;
|
||
Label25: TLabel;
|
||
APID: TEdit;
|
||
BTAdd: TButton;
|
||
BTEdit: TButton;
|
||
ToolBar1: TToolBar;
|
||
ToolButton1: TToolButton;
|
||
TBCD: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel7: TPanel;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
tv2CDType: TcxGridDBColumn;
|
||
tv2CDWZ: TcxGridDBColumn;
|
||
Tv2CDQty: TcxGridDBColumn;
|
||
Tv2CDReason: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
Panel8: TPanel;
|
||
Button3: TButton;
|
||
AOrdDefNote1: TRichEdit;
|
||
Label34: TLabel;
|
||
ComboBox1: TComboBox;
|
||
Edit7: TEdit;
|
||
Label35: TLabel;
|
||
SpeedButton19: TSpeedButton;
|
||
SpeedButton20: TSpeedButton;
|
||
SpeedButton27: TSpeedButton;
|
||
SpeedButton28: TSpeedButton;
|
||
SpeedButton35: TSpeedButton;
|
||
SpeedButton36: TSpeedButton;
|
||
SpeedButton43: TSpeedButton;
|
||
SpeedButton44: TSpeedButton;
|
||
SpeedButton52: TSpeedButton;
|
||
SpeedButton53: TSpeedButton;
|
||
SpeedButton60: TSpeedButton;
|
||
SpeedButton61: TSpeedButton;
|
||
SpeedButton68: TSpeedButton;
|
||
SpeedButton69: TSpeedButton;
|
||
SpeedButton76: TSpeedButton;
|
||
SpeedButton77: TSpeedButton;
|
||
SpeedButton78: TSpeedButton;
|
||
SpeedButton79: TSpeedButton;
|
||
SpeedButton80: TSpeedButton;
|
||
SpeedButton81: TSpeedButton;
|
||
SpeedButton82: TSpeedButton;
|
||
SpeedButton83: TSpeedButton;
|
||
v3Column4: TcxGridDBColumn;
|
||
Button6: TButton;
|
||
Label36: TLabel;
|
||
MJStr4: TEdit;
|
||
Label37: TLabel;
|
||
v3Column5: TcxGridDBColumn;
|
||
Label38: TLabel;
|
||
RM3: TRMGridReport;
|
||
Label39: TLabel;
|
||
Edit8: TEdit;
|
||
mjxh: TEdit;
|
||
ADOTmp: TADOQuery;
|
||
MKXS: TEdit;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
Button7: TButton;
|
||
ADOQuery1: TADOQuery;
|
||
Panel9: TPanel;
|
||
Label41: TLabel;
|
||
Edit9: TEdit;
|
||
ComboBox2: TComboBox;
|
||
Label40: TLabel;
|
||
Edit10: TEdit;
|
||
Label42: TLabel;
|
||
Edit11: TEdit;
|
||
Label43: TLabel;
|
||
ADOQuery2: TADOQuery;
|
||
Panel1: TPanel;
|
||
Label55: TLabel;
|
||
Label56: TLabel;
|
||
Label45: TLabel;
|
||
Label44: TLabel;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
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 MJFKClick(Sender: TObject);
|
||
procedure MJBanZuClick(Sender: TObject);
|
||
procedure MJSJKZClick(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 BTAddClick(Sender: TObject);
|
||
procedure BTEditClick(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 Button4Click(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 Edit3Click(Sender: TObject);
|
||
procedure Edit4Click(Sender: TObject);
|
||
procedure Edit5Click(Sender: TObject);
|
||
procedure Edit6Click(Sender: TObject);
|
||
procedure MJstr3KeyPress(Sender: TObject; var Key: Char);
|
||
procedure MJQty3Exit(Sender: TObject);
|
||
procedure MJMaoZExit(Sender: TObject);
|
||
procedure Label9Click(Sender: TObject);
|
||
procedure MJLenExit(Sender: TObject);
|
||
procedure MJQty4Exit(Sender: TObject);
|
||
procedure Button2Click(Sender: TObject);
|
||
procedure MJQty4Change(Sender: TObject);
|
||
procedure MJMaoZChange(Sender: TObject);
|
||
procedure APIDClick(Sender: TObject);
|
||
procedure Button3Click(Sender: TObject);
|
||
procedure MJFKChange(Sender: TObject);
|
||
procedure Edit7Click(Sender: TObject);
|
||
procedure Button6Click(Sender: TObject);
|
||
procedure MJQty4KeyPress(Sender: TObject; var Key: Char);
|
||
procedure MKXSChange(Sender: TObject);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure MJQty2Change(Sender: TObject);
|
||
procedure Edit8Click(Sender: TObject);
|
||
procedure MJLenChange(Sender: TObject);
|
||
procedure tv2CDWZPropertiesEditValueChanged(Sender: TObject);
|
||
procedure v2Column2PropertiesEditValueChanged(Sender: TObject);
|
||
procedure Tv3CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure Button7Click(Sender: TObject);
|
||
procedure MJXHCXChange(Sender: TObject);
|
||
procedure MJXHCXClick(Sender: TObject);
|
||
procedure Edit10Click(Sender: TObject);
|
||
procedure Edit11Click(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
FInt, PState, PrintInt, SCInitGrid, FState, FCK: Integer;
|
||
FColumn, FBanZu, FAPID, FMainId, FSubId, FFFMJID, FOrderUnit: string;
|
||
MValue, FCDName: string;
|
||
FZDJH: Double;
|
||
FConPerson2, FconDefstr2, FconDefstr3, FConNo, FKHConNO: string;
|
||
isCommopen, IsJsMessage: boolean;
|
||
fxsType, FStyleNo, FConid, FMPrtCode: string;
|
||
FOrdDate: TDateTime;
|
||
procedure InitJP();
|
||
procedure InitCDGrid();
|
||
procedure InitCDGridID();
|
||
procedure AddCD(Fbtn: TButton);
|
||
procedure AddSL(Fbtn: TButton);
|
||
function SaveData(): Boolean;
|
||
procedure BtnStatus(BSInt: Boolean);
|
||
procedure AddSLNew(Fbtn: TSpeedButton);
|
||
procedure AddCDNew(Fbtn: TSpeedButton);
|
||
procedure SavedataCK();
|
||
procedure PrtData(FMJID: string);
|
||
procedure OpenCom(DllName: string);
|
||
procedure CloseCom(DllName: string);
|
||
procedure On1201(var Message: Tmessage); message 1201; // <20><><EFBFBD>ӳ<EFBFBD>
|
||
procedure On1301(var Message: Tmessage); message 1301; //<2F><><EFBFBD><EFBFBD>
|
||
public
|
||
fmanage: string;
|
||
{ Public declarations }
|
||
|
||
end;
|
||
|
||
var
|
||
frmMJManageNewFDNewSF: TfrmMJManageNewFDNewSF;
|
||
newh, newh1: hwnd;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_Fun, U_ZDYHelp, U_iniParam, U_ClothHCList;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmMJManageNewFDNewSF.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 TfrmMJManageNewFDNewSF.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 TfrmMJManageNewFDNewSF.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmMJManageNewFDNewSF := nil;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.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]);
|
||
//IF i2=0 then Label9.Caption:='M' else Label9.Caption:='Y';
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.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(Edit11.Text) = '<27><>' then
|
||
begin
|
||
if (MKXS.Text <> '0') and (MKXS.Text <> '') then
|
||
MJLen.Text := format('%.1f', [i1 / 100000])
|
||
else
|
||
MJLen.Text := format('%.0f', [i1 / 100000]);
|
||
if i2 = 0 then
|
||
Label9.Caption := 'M'
|
||
else
|
||
Label9.Caption := 'Y';
|
||
end;
|
||
end;
|
||
{
|
||
//Edit1.Text:= floattostr(i1 *i2 /100000 );
|
||
IF IsJsMessage then
|
||
MJMaoZ.Text:= floattostr(i1 *i2 /100000 ); }
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
if isCommopen then
|
||
begin
|
||
closeCom(DllName);
|
||
closeCom(JCYDLL);
|
||
end;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.InitCDGrid();
|
||
begin
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
if PState = 1 then
|
||
sql.Add('select * from WFB_MJJY_CD where MJID='''' ')
|
||
else
|
||
sql.Add('select * from WFB_MJJY_CD where MJID=''' + Trim(CDS_MJID.fieldbyname('MJID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1, CDS_MJCD);
|
||
SInitCDSData20(ADOQuery1, CDS_MJCD);
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.InitCDGridID();
|
||
begin
|
||
// with ADOQueryMain do
|
||
// begin
|
||
// Filtered := False;
|
||
// Close;
|
||
// SQL.Clear;
|
||
// sql.Add('select A.*,A.MJXH MJXHCX ');
|
||
// 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)+'''');
|
||
// Open;
|
||
// end;
|
||
// SCreateCDS20(ADOQueryMain, CDS_MJID);
|
||
// SInitCDSData20(ADOQueryMain, CDS_MJID);
|
||
// CDS_MJID.last;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
Filtered := False;
|
||
SQL.Clear;
|
||
sql.Add('select A.MJID,A.MJXH,A.MJLen,A.MJMaoZ,A.MJQty4,A.MJType,A.MJXH as MJXHCX '); //Top 200
|
||
sql.Add('from WFB_MJJY A with(nolock) ');
|
||
sql.Add('where APID=''' + Trim(FAPID) + '''');
|
||
// if Trim(SCXFlag)<>'' then
|
||
// sql.Add(' and JTType='''+Trim(SCXFlag)+'''');
|
||
//sql.Add(' and Filler='''+Trim(DName)+'''');
|
||
sql.Add('order by A.FillTime desc ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, CDS_MJID);
|
||
SInitCDSData20(ADOQueryMain, CDS_MJID);
|
||
// Label55.caption := '';
|
||
// with ADOTmp do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.Add('select COUNT(MJID) as SMJXH from WFB_MJJY where APID=''' + Trim(FAPID) + ''' ');
|
||
// Open;
|
||
// end;
|
||
// Label55.caption := '<27>ܾ<EFBFBD><DCBE><EFBFBD><EFBFBD><EFBFBD>' + Trim(ADOTmp.fieldbyname('SMJXH').AsString);
|
||
// Label45.caption := '';
|
||
// with ADOTmp do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.Add('select sum(MJlen) as SMJlen from WFB_MJJY where APID=''' + Trim(FAPID) + ''' ');
|
||
// Open;
|
||
// end;
|
||
// Label45.caption := '<27>ܳ<EFBFBD><DCB3>ȣ<EFBFBD>' + Trim(ADOTmp.fieldbyname('SMJlen').AsString);
|
||
// Label56.caption := '';
|
||
// with ADOTmp do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.Add('select sum(MJQty4) as SMJQty4 from WFB_MJJY where APID=''' + Trim(FAPID) + ''' ');
|
||
// Open;
|
||
// end;
|
||
// Label56.caption := '<27>ܾ<EFBFBD><DCBE>أ<EFBFBD>' + Trim(ADOTmp.fieldbyname('SMJQty4').AsString);
|
||
// Label44.caption := '';
|
||
// with ADOTmp do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// sql.Add('select sum(MJMaoZ) as SMJMaoZ from WFB_MJJY where APID=''' + Trim(FAPID) + ''' ');
|
||
// Open;
|
||
// end;
|
||
// Label44.caption := '<27><>ë<EFBFBD>أ<EFBFBD>' + Trim(ADOTmp.fieldbyname('SMJMaoZ').AsString);
|
||
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.TBCloseClick(Sender: TObject);
|
||
var
|
||
maxno: string;
|
||
begin
|
||
if CDS_MJCD.IsEmpty = False then
|
||
begin
|
||
if Trim(CDS_MJCD.FieldByName('MCID').AsString) = '' then
|
||
begin
|
||
//try
|
||
//ADOCmd.Connection.BeginTrans;
|
||
{with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete from WFB_MJJY_CD_Temp where JTType='''+Trim(SCXFlag)+'''');
|
||
Execsql;
|
||
end;
|
||
with CDS_MJCD do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if GetLSNo(ADOCmd,maxno,'LS','WFB_MJJY_CD_Temp',2,1)=False then
|
||
begin
|
||
// ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<>õ<EFBFBD><C3B5><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from WFB_MJJY_CD_Temp where 1<>1');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('MCID').Value:=Trim(maxno);
|
||
SSetSaveDataCDSNew(ADOCmd,Tv2,CDS_MJCD,'WFB_MJJY_CD_Temp',0);
|
||
FieldByName('JTType').Value:=Trim(SCXFlag);
|
||
Post;
|
||
end;
|
||
Next;
|
||
end;
|
||
end; }
|
||
close;
|
||
//ADOCmd.Connection.CommitTrans;
|
||
//ModalResult:=1;
|
||
//except
|
||
//ADOCmd.Connection.RollbackTrans;
|
||
//Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
//end;
|
||
end
|
||
else
|
||
begin
|
||
Close;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
Close;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.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 TfrmMJManageNewFDNewSF.FormShow(Sender: TObject);
|
||
begin
|
||
InitJP();
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select BanZu from SY_User where UserId=''' + Trim(DCode) + '''');
|
||
Open;
|
||
FBanZu := Trim(Fieldbyname('BanZu').AsString);
|
||
end;
|
||
{if Trim(FBanZu)='' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ð<EFBFBD><C3B0>飡','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
APID.SetFocus;
|
||
{if CommOpen(frmMJManageNewFDNewSF.Handle,pchar(PortNoStr),500,1)<1 then
|
||
begin
|
||
FCK:=1;
|
||
showmessage('<27><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>ʧ<EFBFBD><CAA7>!');
|
||
end else
|
||
begin
|
||
FCk:=9;
|
||
end;}
|
||
if trim(Edit7.Text) = '<27><>' then
|
||
IsJsMessage := true;
|
||
|
||
if trim(fmanage) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
{if CommOpen(self.Handle,pchar(trim('com4')),500,1)<1 then
|
||
begin
|
||
showmessage('<27><><EFBFBD><EFBFBD>');
|
||
end
|
||
else
|
||
begin
|
||
end;}
|
||
OpenCom(DllName);
|
||
OpenCom(JCYDLL);
|
||
Edit7.Visible := true;
|
||
Label35.Visible := true;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.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 > 69 then
|
||
begin
|
||
i := 69;
|
||
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 TfrmMJManageNewFDNewSF.AddCD(Fbtn: TButton);
|
||
begin
|
||
if PState < 1 then
|
||
Exit;
|
||
if Order_MJ.IsEmpty then
|
||
Exit;
|
||
with CDS_MJCD do
|
||
begin
|
||
Append;
|
||
FieldByName('cdname').Value := Trim(TButton(Fbtn).Caption);
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.AddCDNew(Fbtn: TSpeedButton);
|
||
begin
|
||
with CDS_MJCD do
|
||
begin
|
||
Append;
|
||
FieldByName('cdname').Value := Trim(TSpeedButton(Fbtn).Hint);
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.AddSL(Fbtn: TButton);
|
||
begin
|
||
if PState < 1 then
|
||
Exit;
|
||
if Order_MJ.IsEmpty then
|
||
Exit;
|
||
|
||
//if MJMaoZ.Focused then
|
||
if FInt = 4 then
|
||
Exit;
|
||
if CDS_MJCD.IsEmpty = False then
|
||
begin
|
||
FColumn := Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
||
if Trim(FColumn) <> '' then
|
||
begin
|
||
with CDS_MJCD do
|
||
begin
|
||
Edit;
|
||
FieldByName(FColumn).Value := Trim(FieldByName(FColumn).AsString) + Trim(TButton(Fbtn).Caption);
|
||
if Trim(fieldbyname('CDQtyS').AsString) <> '' then
|
||
Fieldbyname('CDQty').Value := Trim(fieldbyname('CDQtyS').AsString);
|
||
Post;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.AddSLNew(Fbtn: TSpeedButton);
|
||
begin
|
||
if PState < 1 then
|
||
Exit;
|
||
if Trim(FAPID) = '' then
|
||
Exit;
|
||
|
||
//if MJMaoZ.Focused then
|
||
if FInt = 4 then
|
||
Exit;
|
||
if FInt = 11 then
|
||
begin
|
||
if TSpeedButton(Fbtn).Tag = 9 then
|
||
Exit;
|
||
Edit1.Text := Trim(Edit1.Text) + Trim(TSpeedButton(Fbtn).Caption);
|
||
Edit1.SelectAll;
|
||
end
|
||
else if FInt = 12 then
|
||
begin
|
||
if TSpeedButton(Fbtn).Tag = 9 then
|
||
Exit;
|
||
Edit2.Text := Trim(Edit2.Text) + Trim(TSpeedButton(Fbtn).Caption);
|
||
Edit2.SelectAll;
|
||
end; { else
|
||
if CDS_MJCD.IsEmpty=False then
|
||
begin
|
||
FColumn:=Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
||
if Trim(FColumn)<>'' then
|
||
begin
|
||
with CDS_MJCD do
|
||
begin
|
||
Edit;
|
||
FieldByName(FColumn).Value:=Trim(FieldByName(FColumn).AsString)+Trim(TButton(Fbtn).Caption);
|
||
if Trim(fieldbyname('CDQtyS').AsString)<>'' then
|
||
Fieldbyname('CDQty').Value:=Trim(fieldbyname('CDQtyS').AsString);
|
||
Post;
|
||
end;
|
||
end;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
//if Tv2.OptionsSelection.CellSelect=True then
|
||
if CDS_MJCD.IsEmpty then
|
||
Exit;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
|
||
if Trim(CDS_MJCD.fieldbyname('MCID').AsString) = '' then
|
||
begin
|
||
CDS_MJCD.Delete;
|
||
end
|
||
else
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('delete from WFB_MJJY_CD where MCID=''' + Trim(CDS_MJCD.fieldbyname('MCID').AsString) + '''');
|
||
execsql;
|
||
end;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update WFB_MJJY SET ZCDName=dbo.F_Get_Order_SubStr(MJID,''QDHZ'')');
|
||
sql.Add(' where MJID=''' + Trim(CDS_MJCD.fieldbyname('MJID').AsString) + '''');
|
||
execsql;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MJMaoZClick(Sender: TObject);
|
||
begin
|
||
FInt := 1;
|
||
FColumn := '';
|
||
panel3.Visible := True;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MJLenClick(Sender: TObject);
|
||
begin
|
||
FInt := 2;
|
||
FColumn := '';
|
||
panel3.Visible := True;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MJFKClick(Sender: TObject);
|
||
begin
|
||
FInt := 3;
|
||
FColumn := '';
|
||
panel3.Visible := True;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MJBanZuClick(Sender: TObject);
|
||
begin
|
||
FInt := 4;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MJSJKZClick(Sender: TObject);
|
||
begin
|
||
FInt := 4;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
|
||
FInt := 4;
|
||
InitCDGridID();
|
||
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.Tv3CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
if CDS_MJCD.IsEmpty = False then
|
||
begin
|
||
if Trim(CDS_MJCD.fieldbyname('MCID').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;
|
||
|
||
FInt := 4;
|
||
// PState:=0;
|
||
PState := 2;
|
||
InitCDGrid();
|
||
with ADOTmp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from WFB_MJJY where MJID=''' + Trim(CDS_MJID.fieldbyname('MJID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
MJFK.Text := Trim(ADOTmp.fieldbyname('MJFK').AsString);
|
||
MJSJKZ.Text := Trim(ADOTmp.fieldbyname('MJSJKZ').AsString);
|
||
MJstr4.Text := Trim(ADOTmp.fieldbyname('MJstr4').AsString);
|
||
MJXH.Text := Trim(ADOTmp.fieldbyname('MJXH').AsString);
|
||
MJQty1.Text := Trim(ADOTmp.fieldbyname('MJQty1').AsString);
|
||
MJQty2.Text := Trim(ADOTmp.fieldbyname('MJQty2').AsString);
|
||
MJMaoZ.Text := Trim(ADOTmp.fieldbyname('MJMaoZ').AsString);
|
||
Label15.Caption := Trim(CDS_MJID.fieldbyname('MJID').AsString);
|
||
MJLen.Text := Trim(ADOTmp.fieldbyname('MJLen').AsString);
|
||
if trim(ADOTmp.fieldbyname('DJType').AsString) <> '' then
|
||
ComBoBox2.Text := trim(ADOTmp.fieldbyname('DJType').AsString)
|
||
else
|
||
ComBoBox2.Text := '<27><EFBFBD>';
|
||
if Trim(ADOTmp.fieldbyname('MJType').AsString) = '<27><>Ʒ' then
|
||
begin
|
||
Edit3.Text := '<27><>';
|
||
Edit4.Text := '';
|
||
Edit5.Text := '';
|
||
end
|
||
else if Trim(ADOTmp.fieldbyname('MJType').AsString) = '<27><>Ʒ' then
|
||
begin
|
||
Edit4.Text := '<27><>';
|
||
Edit3.Text := '';
|
||
Edit5.Text := '';
|
||
end
|
||
else if Trim(ADOTmp.fieldbyname('MJType').AsString) = '<27><><EFBFBD><EFBFBD>' then
|
||
begin
|
||
Edit4.Text := '';
|
||
Edit3.Text := '';
|
||
Edit5.Text := '<27><>';
|
||
end;
|
||
BtnStatus(False);
|
||
Label16.Caption := '';
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.FormClick(Sender: TObject);
|
||
begin
|
||
FInt := 4;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.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 TfrmMJManageNewFDNewSF.SaveData(): Boolean;
|
||
var
|
||
maxno, FMJID, BZID, strsql, FTM, FTMID, FCD, FMZ, FKHZ, FKHY: string;
|
||
FMJLen: Double;
|
||
FOrder, i: Integer;
|
||
DETM, FDECD, FDEHX: string;
|
||
CRID: Integer;
|
||
MaxCkNo, MaxCkSubNo, DBID: string;
|
||
begin
|
||
if PState = 1 then
|
||
FMJID := ''
|
||
else if PState = 2 then
|
||
FMJID := Trim(CDS_MJID.fieldbyname('MJID').AsString)
|
||
else if PState < 1 then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
Exit;
|
||
end;
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * ');
|
||
sql.Add('from WFB_MJJY A where MJId=''' + Trim(FMJID) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(FMJID) = '' then
|
||
begin
|
||
Append;
|
||
if GetLSNo(ADOTmp, maxno, Trim(SCXFlag), 'WFB_MJJY', 5, 1) = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
BTPrint.Enabled := true;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
maxno := Trim(FMJID);
|
||
Edit;
|
||
end;
|
||
FKHZ := Copy(Trim(FStyleNo), 1, 3);
|
||
FKHY := Copy(Trim(FStyleNo), 5, 7);
|
||
if (FOrderUnit <> 'KG') and (FOrderUnit <> 'Kg') and (FOrderUnit <> 'kg') then
|
||
begin
|
||
if Pos('.', Trim(MJLen.Text)) = 0 then
|
||
begin
|
||
if Length(Trim(MJLen.Text)) = 1 then
|
||
FCD := '0' + Trim(MJLen.Text) + '0000'
|
||
else
|
||
FCD := Trim(MJLen.Text) + '0000';
|
||
end
|
||
else
|
||
begin
|
||
if Length(Copy(Trim(MJLen.Text), 1, Pos('.', Trim(MJLen.Text)) - 1)) = 1 then
|
||
FCD := '0' + trim(MJLen.Text) + '0000'
|
||
else
|
||
FCD := Trim(MJLen.Text) + '0000';
|
||
FCD := Copy(Trim(FCD), 1, Pos('.', Trim(FCD)) - 1) + Copy(Trim(FCD), Pos('.', Trim(FCD)) + 1, 3);
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
if Pos('.', Trim(MJQty4.Text)) = 0 then
|
||
begin
|
||
if Length(Trim(MJQty4.Text)) = 1 then
|
||
FCD := '0' + Trim(MJQty4.Text) + '0000'
|
||
else
|
||
FCD := Trim(MJQty4.Text) + '0000';
|
||
end
|
||
else
|
||
begin
|
||
if Length(Copy(Trim(MJQty4.Text), 1, Pos('.', Trim(MJQty4.Text)) - 1)) = 1 then
|
||
FCD := '0' + Trim(MJQty4.Text) + '0000'
|
||
else
|
||
FCD := Trim(MJQty4.Text) + '0000';
|
||
FCD := Copy(Trim(FCD), 1, Pos('.', Trim(FCD)) - 1) + Copy(Trim(FCD), Pos('.', Trim(FCD)) + 1, 3);
|
||
end;
|
||
end;
|
||
FCD := Copy(Trim(FCD), 1, 4);
|
||
FMZ := '0000' + trim(MJXH.Text);
|
||
FMZ := Copy(Trim(FMZ), Length(FMZ) - 3, Length(FMZ));
|
||
FTM := trim(FKHZ) + trim(FKHY) + copy(Trim(Label2.Caption) + Trim(Label43.Caption), 1, 3) + '0' + trim(FCD) + trim(MJStr4.Text) + trim(FMZ);
|
||
FieldByName('TM').Value := Trim(FTM);
|
||
FieldByName('MZ').Value := Trim(FMZ);
|
||
|
||
FDEHX := '00000000' + Trim(Label2.Caption);
|
||
FDEHX := Copy(Trim(FDEHX), Length(FDEHX) - 7, Length(FDEHX));
|
||
if Pos('.', Trim(MJMaoZ.Text)) = 0 then
|
||
begin
|
||
if Length(Trim(MJMaoZ.Text)) = 1 then
|
||
FDECD := '0' + Trim(MJMaoZ.Text) + '0000'
|
||
else
|
||
FDECD := Trim(MJMaoZ.Text) + '0000';
|
||
end
|
||
else
|
||
begin
|
||
if Length(Copy(Trim(MJMaoZ.Text), 1, Pos('.', Trim(MJMaoZ.Text)) - 1)) = 1 then
|
||
FDECD := '0' + Trim(MJMaoZ.Text) + '0000'
|
||
else
|
||
FDECD := Trim(MJMaoZ.Text) + '0000';
|
||
FDECD := Copy(Trim(FDECD), 1, Pos('.', Trim(FDECD)) - 1) + Copy(Trim(FDECD), Pos('.', Trim(FDECD)) + 1, 3);
|
||
end;
|
||
FDECD := Copy(Trim(FDECD), 1, 4);
|
||
DETM := formatdatetime('yy', now) + trim(FKHConNo) + '@' + trim(FStyleNo) + Trim(FDEHX) + Trim(Label43.Caption) + '@' + trim(FDECD);
|
||
FieldByName('DETM').Value := Trim(DETM);
|
||
FieldByName('MainId').value := Trim(FMainId);
|
||
FieldByName('SubId').value := Trim(FSubId);
|
||
FieldByName('APId').value := Trim(FAPID);
|
||
FieldByName('MJID').Value := Trim(maxno);
|
||
FieldByName('WCStatus').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
if Trim(FMJID) = '' then
|
||
begin
|
||
FieldByName('MJStr2').Value := 'δ<><CEB4><EFBFBD><EFBFBD>';
|
||
end;
|
||
FieldByName('MJBanZu').Value := Trim(FBanZu);
|
||
FieldByName('MJstr3').Value := Trim(MJstr3.Text);
|
||
FieldByName('MJstr4').Value := Trim(MJstr4.Text);
|
||
FieldByName('mjxh').Value := strtointdef(trim(mjxh.Text), 0);
|
||
Fieldbyname('ConID').Value := trim(FConid);
|
||
FieldByName('MJTypeOther').Value := Trim(Label9.Caption);
|
||
FieldByName('MJStr1').Value := Trim(Label13.Caption);
|
||
FieldByName('MJLen').Value := StrToFloatdef(trim(MJLen.Text), 0);
|
||
FieldByName('MJQty1').Value := StrToFloatdef(trim(MJQty1.Text), 0);
|
||
FieldByName('MJQty2').Value := StrToFloatdef(trim(MJQty2.Text), 0);
|
||
FieldByName('MJQty3').Value := StrToFloatdef(trim(MJQty3.Text), 0);
|
||
FieldByName('MJQty4').Value := StrToFloatdef(trim(MJQty4.Text), 0);
|
||
FieldByName('MKXS').Value := StrToFloatdef(trim(MKXS.Text), 0);
|
||
FieldByName('DJType').Value := trim(Combobox2.Text);
|
||
FieldByName('MJFK').Value := StrToFloatdef(trim(MJFK.Text), 0);
|
||
FieldByName('MJSJKZ').Value := StrToFloatdef(trim(MJSJKZ.Text), 0);
|
||
FieldByName('MJMaoZ').Value := StrToFloatdef(trim(MJMaoZ.Text), 0);
|
||
//FieldByName('baoNO').Value:=NULL;
|
||
//FieldByName('baoID').Value:=NULL;
|
||
if Trim(Edit3.Text) <> '' then
|
||
begin
|
||
FieldByName('MJType').Value := '<27><>Ʒ';
|
||
end;
|
||
if Trim(Edit4.Text) <> '' then
|
||
begin
|
||
FieldByName('MJType').Value := '<27><>Ʒ';
|
||
end;
|
||
if Trim(Edit5.Text) <> '' then
|
||
begin
|
||
FieldByName('MJType').Value := '<27><>ƴ';
|
||
end;
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
if Trim(FMJID) <> '' then
|
||
begin
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('EditTime').Value := SGetServerDateTime(ADOTmp);
|
||
end;
|
||
if Trim(SCXFlag) <> '' then
|
||
begin
|
||
FieldByName('JTType').Value := Trim(SCXFlag);
|
||
end;
|
||
Post;
|
||
end;
|
||
if PState = 1 then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update WFB_MJJY SET mjxh=1+isnull((select cast (max(mjxh) as int) from WFB_MJJY X where ');
|
||
sql.add('X.mainiD=WFB_MJJY.mainID and X.subID=WFB_MJJY.subID ');
|
||
if ComboBox2.Text = '<27><EFBFBD>' then
|
||
sql.add('and X.APId=WFB_MJJY.APID and X.MJstr4=WFB_MJJY.Mjstr4 ');
|
||
sql.Add('and X.MJID<>WFB_MJJY.MJID ');
|
||
sql.add(' ),0)');
|
||
sql.Add(' where MJID=''' + Trim(maxno) + '''');
|
||
execsql;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select MJXH from WFB_MJJY ');
|
||
sql.Add('where MJID=''' + Trim(maxno) + '''');
|
||
open;
|
||
if not IsEmpty then
|
||
begin
|
||
MJXH.Text := fieldbyname('mjxh').AsString;
|
||
end;
|
||
end;
|
||
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;
|
||
BTPrint.Enabled := true;
|
||
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);
|
||
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 ZCDName=dbo.F_Get_Order_SubStr(MJID,''QDHZ'')');
|
||
sql.Add(' where MJID=''' + Trim(FMJID) + '''');
|
||
execsql;
|
||
end;
|
||
//<2F><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_BanCP_CR where MJID=''' + trim(FMJID) + ''' and CRFlag like ''%<25><><EFBFBD><EFBFBD>%''');
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.IsEmpty then
|
||
begin
|
||
with ADOQuery2 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.add('Update CK_BanCP_CRID Set CRID=CRID+1');
|
||
sql.Add('select * from CK_BanCP_CRID');
|
||
Open;
|
||
end;
|
||
CRID := ADOQuery2.fieldbyname('CRID').Value;
|
||
with ADOQuery2 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.add('select * from CK_BanCP_CR');
|
||
sql.Add(' where CRID=''' + trim(IntToStr(CRID)) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQuery2.IsEmpty = false then
|
||
begin
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.add('Update CK_BanCP_CRID Set CRID=CRID+1');
|
||
sql.Add('select * from CK_BanCP_CRID');
|
||
Open;
|
||
end;
|
||
CRID := ADOQuery1.fieldbyname('CRID').Value;
|
||
end;
|
||
if GetLSNo(ADOQuery2, MaxCkNo, 'JK', 'CK_BanCP_CR', 5, 1) = False then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1>Ʒ<EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
MaxCkNo := trim(ADOQueryCmd.fieldbyname('BCID').AsString);
|
||
CRID := ADOQueryCmd.fieldbyname('CRID').Value;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_BanCP_CR where MJID=''' + trim(FMJID) + ''' and CRFlag like ''%<25><><EFBFBD><EFBFBD>%''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if isempty then
|
||
begin
|
||
Append;
|
||
end
|
||
else
|
||
edit;
|
||
FieldByName('BCID').Value := Trim(MaxCkNo);
|
||
FieldByName('MainId').value := Trim(FMainId);
|
||
FieldByName('SubId').value := Trim(FSubId);
|
||
FieldByName('APId').value := Trim(FAPID);
|
||
FieldByName('MJID').Value := Trim(FMJID);
|
||
FieldByName('CRFlagQty').Value := 0;
|
||
FieldByName('AOrdDefStr1').Value := Trim(MJStr4.Text);
|
||
FieldByName('MJXH').Value := Trim(mjxh.Text);
|
||
FieldByName('CRFlag').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
FieldByName('CRID').Value := CRID;
|
||
if MJMaoZ.Text = '' then
|
||
FieldByName('KGQty').Value := '0'
|
||
else
|
||
begin
|
||
FieldByName('KGQty').Value := MJMaoZ.Text;
|
||
end;
|
||
if MJQty4.Text = '' then
|
||
FieldByName('MJQty4').Value := '0'
|
||
else
|
||
begin
|
||
FieldByName('MJQty4').Value := MJQty4.Text;
|
||
end;
|
||
if MJLen.Text = '' then
|
||
FieldByName('Qty').Value := '0'
|
||
else
|
||
begin
|
||
FieldByName('Qty').Value := MJLen.Text;
|
||
end;
|
||
FieldByName('QtyUnit').Value := Trim(Label9.Caption);
|
||
if Trim(Edit3.Text) <> '' then
|
||
begin
|
||
FieldByName('CPType').Value := '<27><>Ʒ';
|
||
end;
|
||
if Trim(Edit4.Text) <> '' then
|
||
begin
|
||
FieldByName('CPType').Value := '<27><>Ʒ';
|
||
end;
|
||
if Trim(Edit5.Text) <> '' then
|
||
begin
|
||
FieldByName('CPType').Value := '<27><>ƴ';
|
||
end;
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('ConPerson2').Value := Trim(FConPerson2);
|
||
FieldByName('conDefstr2').Value := Trim(FconDefstr2);
|
||
FieldByName('conDefstr3').Value := Trim(FconDefstr3);
|
||
FieldByName('ConNo').Value := Trim(FConNo);
|
||
FieldByName('KHConNO').Value := Trim(FKHConNO);
|
||
FieldByName('StyleNo').Value := Trim(FStyleNo);
|
||
FieldByName('ConID').Value := trim(FConid);
|
||
Post;
|
||
end;
|
||
|
||
//<2F><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_BanCP_CR where MJID=''' + trim(FMJID) + ''' and CRFlag like ''%<25><><EFBFBD><EFBFBD>%''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if isempty then
|
||
begin
|
||
Append;
|
||
end
|
||
else
|
||
edit;
|
||
FieldByName('BCID').Value := 'CK' + Trim(MaxCkNo);
|
||
FieldByName('MainId').value := Trim(FMainId);
|
||
FieldByName('SubId').value := Trim(FSubId);
|
||
FieldByName('APId').value := Trim(FAPID);
|
||
FieldByName('MJID').Value := Trim(FMJID);
|
||
FieldByName('CRFlagQty').Value := 0;
|
||
FieldByName('AOrdDefStr1').Value := Trim(MJStr4.Text);
|
||
FieldByName('MJXH').Value := Trim(mjxh.Text);
|
||
FieldByName('CRFlag').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
FieldByName('CRID').Value := CRID;
|
||
if MJMaoZ.Text = '' then
|
||
FieldByName('KGQty').Value := '0'
|
||
else
|
||
begin
|
||
FieldByName('KGQty').Value := MJMaoZ.Text;
|
||
end;
|
||
if MJQty4.Text = '' then
|
||
FieldByName('MJQty4').Value := '0'
|
||
else
|
||
begin
|
||
FieldByName('MJQty4').Value := MJQty4.Text;
|
||
end;
|
||
if MJLen.Text = '' then
|
||
FieldByName('Qty').Value := '0'
|
||
else
|
||
begin
|
||
FieldByName('Qty').Value := MJLen.Text;
|
||
end;
|
||
FieldByName('QtyUnit').Value := Trim(Label9.Caption);
|
||
if Trim(Edit3.Text) <> '' then
|
||
begin
|
||
FieldByName('CPType').Value := '<27><>Ʒ';
|
||
end;
|
||
if Trim(Edit4.Text) <> '' then
|
||
begin
|
||
FieldByName('CPType').Value := '<27><>Ʒ';
|
||
end;
|
||
if Trim(Edit5.Text) <> '' then
|
||
begin
|
||
FieldByName('CPType').Value := '<27><>ƴ';
|
||
end;
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('ConPerson2').Value := Trim(FConPerson2);
|
||
FieldByName('conDefstr2').Value := Trim(FconDefstr2);
|
||
FieldByName('conDefstr3').Value := Trim(FconDefstr3);
|
||
FieldByName('ConNo').Value := Trim(FConNo);
|
||
FieldByName('KHConNO').Value := Trim(FKHConNO);
|
||
FieldByName('StyleNo').Value := Trim(FStyleNo);
|
||
FieldByName('ConID').Value := trim(FConid);
|
||
Post;
|
||
end;
|
||
//<2F><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_BanCP_KC where MJID=''' + trim(FMJID) + ''' ');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if isempty then
|
||
begin
|
||
Append;
|
||
end
|
||
else
|
||
edit;
|
||
FieldByName('BCID').Value := Trim(MaxCkNo);
|
||
FieldByName('CRID').Value := CRID;
|
||
FieldByName('MJID').Value := Trim(FMJID);
|
||
FieldByName('KCKGQty').Value := CDS_MJID.fieldbyname('MJMaoZ').AsFloat;
|
||
FieldByName('KCQty').Value := CDS_MJID.fieldbyname('MJLen').AsFloat;
|
||
FieldByName('KCQtyUnit').Value := Label9.Caption;
|
||
Post;
|
||
end;
|
||
PState := 0;
|
||
ADOCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
;
|
||
Result := False;
|
||
BTPrint.Enabled := true;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.BTAddClick(Sender: TObject);
|
||
begin
|
||
if Trim(Label24.Caption) = '' then
|
||
Exit;
|
||
PState := 1;
|
||
InitCDGridID();
|
||
InitCDGrid(); //<2F>õ<EFBFBD>
|
||
BtnStatus(True);
|
||
Label16.Caption := '<27><><EFBFBD><EFBFBD>';
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.BTEditClick(Sender: TObject);
|
||
begin
|
||
if CDS_MJID.IsEmpty then
|
||
Exit;
|
||
PState := 2;
|
||
Label16.Caption := '<27><EFBFBD>';
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.BTPrintClick(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
mvalue: Double;
|
||
i: Integer;
|
||
begin
|
||
BTPrint.Enabled := false;
|
||
if combobox2.Text = '' then
|
||
begin
|
||
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
||
BTPrint.Enabled := true;
|
||
exit;
|
||
end;
|
||
if Trim(FAPID) = '' then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
Exit;
|
||
end;
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select D.LBName,D.NLBName,C.PRTOrderQty,');
|
||
sql.add('SumJZ=(select Sum(E.MJQty4) from WFB_MJJY E where E.APID=A.SPID) ');
|
||
sql.Add('from CK_SXPB_CR A with(nolock) ');
|
||
sql.Add('left join JYOrder_Main D with(nolock) on D.Mainid=A.OrdMainidCK ');
|
||
sql.add('left join JYOrderCon_Sub C with(nolock) on C.Subid=A.ConCKID ');
|
||
SQL.Add('left join JYOrderCon_Main B with(nolock) on B.Mainid=C.MainId ');
|
||
SQL.Add(' where A.SPId=''' + Trim(FAPID) + '''');
|
||
Open;
|
||
if not IsEmpty then
|
||
begin
|
||
if Trim(ADOQueryPrint.fieldbyname('LBName').AsString) = '' then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
application.MessageBox('û<><C3BB><EFBFBD><EFBFBD><EFBFBD>þ<EFBFBD><C3BE><EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
if Edit10.Text <> '' then
|
||
begin
|
||
if Trim(ADOQueryPrint.fieldbyname('NLBName').AsString) = '' then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
application.MessageBox('û<><C3BB><EFBFBD><EFBFBD><EFBFBD>ð<EFBFBD><C3B0><EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
if FInt = 4 then
|
||
begin
|
||
if CDS_MJID.IsEmpty = False then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
Application.MessageBox('<27>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룿<EFBFBD>볢<EFBFBD><EBB3A2><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
if trim(Label9.Caption) = '' then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
Application.MessageBox('<27><><EFBFBD>ȵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Trim(MJQty1.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(MJQty1.Text, mvalue) = False then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
Application.MessageBox('ԭ<><D4AD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if MJLen.Text = '' then
|
||
MJLen.Text := '0';
|
||
if MJQty3.Text = '' then
|
||
MJQty3.Text := '0';
|
||
if MJQty4.Text = '' then
|
||
MJQty4.Text := '0';
|
||
if MJMaoZ.Text = '' then
|
||
MJMaoZ.Text := '0';
|
||
if trim(MJQty4.Text) = '' then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
Application.MessageBox('<27><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if strtofloat(MJQty4.Text) >= 100 then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
Application.MessageBox('<27><><EFBFBD>ز<EFBFBD><D8B2>ܳ<EFBFBD><DCB3><EFBFBD>200KG', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if StrToFloat(MJMaoZ.Text) >= 100 then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ﲻ<EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>200KG', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
if FZDJH > 0 then
|
||
begin
|
||
if strtofloatdef(trim(MJXH.Text), 0) > FZDJH then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
end;
|
||
if Trim(MJFK.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(MJFK.Text, mvalue) = False then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Trim(MJMaoZ.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(MJMaoZ.Text, mvalue) = False then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Trim(MJSJKZ.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(MJSJKZ.Text, mvalue) = False then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Trim(MJQty2.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(MJQty2.Text, mvalue) = False then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if strtofloatdef(trim(MJQty4.Text), 0) < 0.00 then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>0<EFBFBD><30>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
if strtofloatdef(trim(MJLen.Text), 0) < 0.00 then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
application.MessageBox('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>С<EFBFBD><D0A1>0<EFBFBD><30>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
if strtofloatdef(trim(MKXS.Text), 0) <> 0.00 then
|
||
begin
|
||
if strtofloatdef(trim(MJLen.Text), 0) < 0.01 then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
application.MessageBox('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
end;
|
||
if strtofloatdef(trim(MJLen.Text), 0) > 300.00 then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
application.MessageBox('<27><><EFBFBD>Ȳ<EFBFBD><C8B2>ܴ<EFBFBD><DCB4><EFBFBD>300<30><30>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
if MJStr4.Text = '' then
|
||
begin
|
||
if application.MessageBox('ȷ<><C8B7>û<EFBFBD>и<D0B8><D7BA><EFBFBD>', '<27><>ʾ', 1) = 2 then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
if application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA>ӡ<EFBFBD><D3A1>', '<27><>ʾ', 1) = 2 then
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
exit;
|
||
end;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
// sql.Add('select Top 1 A.MJXH ');
|
||
sql.Add('select MAX(A.MJXH) as MJXH ');
|
||
sql.Add('from WFB_MJJY A where 1=1');
|
||
if Trim(ComBoBox2.Text) = '<27><>ɫ' then
|
||
sql.Add(' and A.Subid=''' + trim(FSubId) + ''' ');
|
||
if Trim(ComBoBox2.Text) = '<27><EFBFBD>' then
|
||
sql.Add(' and APID=''' + Trim(FAPID) + '''');
|
||
// sql.Add(' order by A.MJID desc');
|
||
Open;
|
||
end;
|
||
mjxh.Text := IntToStr(ADOCmd.fieldbyname('MJXH').asinteger + 1);
|
||
if SaveData() then
|
||
begin
|
||
MJLen.Text := '';
|
||
MJMaoZ.Text := '';
|
||
MJQty1.Text := '';
|
||
MJQty2.Text := '';
|
||
Label15.Caption := '';
|
||
MJQty4.Text := '';
|
||
Edit3.Text := '<27><>';
|
||
Edit4.Text := '';
|
||
Edit5.Text := '';
|
||
MJFK.Text := '';
|
||
MJSJKZ.Text := '';
|
||
MJXH.Text := inttostr(strTointdef(trim(MJXH.Text), 0) + 1);
|
||
end;
|
||
if Trim(Edit6.Text) = '<27><>' then
|
||
begin
|
||
PrtData(FFFMJID);
|
||
end;
|
||
Label16.Caption := '';
|
||
BTAdd.Click;
|
||
BTPrint.Enabled := true;
|
||
MJMaoZ.SetFocus;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.PrtData(FMJID: string);
|
||
var
|
||
fPrintFile, fPrintFile1, fPrintFile2: string;
|
||
Txt, Txt1, Txt2, Txt3, Txt4, fImagePath, fImagePath1, fImagePath2, fImagePath3, fImagePath4: string;
|
||
Moudle: THandle;
|
||
Makebar: TMakebar;
|
||
Mixtext: TMixtext;
|
||
begin
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select QtyUnit=A.MJTypeOther,B.orderNo,G.ConNo,GangNo=A.MJStr4,A.MJStr4,isnull(C.styleNo,F.StyleNo) StyleNo,G.KHConNo,G.ConLBName,G.ConNLBName');
|
||
sql.Add(',B.MaiTouNote,B.MPRTCode,B.LBName,B.NLBName,B.FBQName ');
|
||
sql.Add(',MPRTCodeNameEng=ISNULL((select Top 1 F.note from KH_Zdy F with(nolock) where F.zdyname=B.MPRTCodeName and F.Type=''PRTCodeName''),B.MPRTCodeName)');
|
||
sql.Add(',B.MPRTCF,B.MPRTMF,B.MPRTKZ,isnull(C.PRTColorEng,F.SOrdDefStr4) OrdPRTColorEng,F.SOrddefstr4,B.MPRTCodeName,B.MPRTSpec,B.MPRTKuanNO,B.LengUnit,D.PiQty ');
|
||
sql.Add(',Case when A.MJSJKZ*A.MJFK<>0 then Cast(A.MJQty4*1000/A.MJSJKZ/(A.MJFK/100) as int) else 0 end as MQty');
|
||
sql.add(',F.XHNo,F.PRTMF,F.PRTKZ,F.PRTCodeName,F.PRTCode,G.CustomerNoName,C.*,A.*,B.Filltime ZDDate');
|
||
sql.add(',CDQty=isnull((select SUM(CDqty) from WFB_MJJY_CD X with(nolock) where X.MJID=A.MJID),0) ');
|
||
sql.add(',SumQty=isnull((select SUM(CDBeg) from WFB_MJJY_CD X with(nolock) where X.MJID=A.MJID),0) ');
|
||
sql.Add(',TLen=cast(MJLen as varchar(10))');
|
||
sql.Add(',FLen=substring(cast(MJLen as varchar(10)),1,LEN(MJLen)-3)+'',''+RIGHT(cast(MJLen as varchar(10)),2)');
|
||
sql.Add(' from WFB_MJJY A with(nolock)');
|
||
sql.Add(' inner join JYOrder_Main B with(nolock) On A.Mainid=B.Mainid');
|
||
sql.Add(' inner join JYOrder_Sub C with(nolock) on A.SubId=C.SubId');
|
||
// sql.Add(' left join KH_Zdy E with(nolock) on C.PRTColor=E.ZdyName and E.Type=''OrdColor'' ');
|
||
sql.Add(' inner join CK_SXPB_CR D with(nolock) on D.SPId=A.APId ');
|
||
sql.add(' left join JYOrderCon_Sub F with(nolock) on F.Subid=A.ConID');
|
||
sql.add(' left join JYOrderCon_Main G with(nolock) on G.Mainid=F.Mainid');
|
||
SQL.Add(' where A.MJID=''' + Trim(FMJID) + '''');
|
||
Open;
|
||
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
|
||
;
|
||
BTPrint.Enabled := true;
|
||
//ADOCmd.Connection.RollbackTrans;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
sleep(500);
|
||
|
||
try
|
||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||
Txt1 := '32' + copy(Label24.Caption, 3, 4) + formatdatetime('yyyyMMdd', ADOQueryPrint.fieldbyname('ZDDate').AsDateTime) + RightStr('10000' + Trim(ADOQueryPrint.fieldbyname('MJXH').AsString), 4);
|
||
fImagePath1 := ExtractFilePath(Application.ExeName) + 'image\temp1.bmp';
|
||
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
||
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
||
if FileExists(fImagePath1) then
|
||
DeleteFile(fImagePath1);
|
||
Makebar(pchar(Txt1), Length(Txt1), 3, 3, 0, PChar(fImagePath1), 4);
|
||
except
|
||
;
|
||
// BTPrint.Enabled:=true;
|
||
//ADOCmd.Connection.RollbackTrans;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
|
||
try
|
||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||
Txt2 := 'NWJ01.100;' + Trim(ADOQueryPrint.fieldbyname('styleNo').AsString) + ';801;' + Trim(ADOQueryPrint.fieldbyname('PRTHX').AsString) + ';' + Trim(ADOQueryPrint.fieldbyname('MJQty4').AsString) + ';' + Trim(ADOQueryPrint.fieldbyname('MJlen').AsString) + ';' + RightStr('10000' + Trim(ADOQueryPrint.fieldbyname('MJXH').AsString), 4);
|
||
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\temp2.bmp';
|
||
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
||
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
||
if FileExists(fImagePath2) then
|
||
DeleteFile(fImagePath2);
|
||
Makebar(pchar(Txt2), Length(Txt2), 3, 3, 0, PChar(fImagePath2), 4);
|
||
except
|
||
;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
try
|
||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||
Txt3 := '32' + copy(Label24.Caption, 3, 4) + '20200101' + RightStr('10000' + Trim(ADOQueryPrint.fieldbyname('MJXH').AsString), 4);
|
||
fImagePath3 := ExtractFilePath(Application.ExeName) + 'image\temp3.bmp';
|
||
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
||
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
||
if FileExists(fImagePath3) then
|
||
DeleteFile(fImagePath3);
|
||
Makebar(pchar(Txt3), Length(Txt3), 3, 3, 0, PChar(fImagePath3), 3);
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
try
|
||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||
Txt4 := '{"A":"' + Trim(ADOQueryPrint.fieldbyname('KHConNO').AsString) + '","B":"' + Trim(ADOQueryPrint.fieldbyname('StyleNo').AsString) + '","C":"' + Trim(ADOQueryPrint.fieldbyname('mjqty4').AsString) + '","D":"' + Trim(ADOQueryPrint.fieldbyname('MJlen').AsString) + '","E":"' + Trim(ADOQueryPrint.fieldbyname('mjstr4').AsString) + '","F":"' + RightStr(('10000' + trim(ADOQueryPrint.fieldbyName('MJXH').AsString)), 4) + '"}';
|
||
fImagePath4 := ExtractFilePath(Application.ExeName) + 'image\temp4.bmp';
|
||
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
||
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
||
if FileExists(fImagePath4) then
|
||
DeleteFile(fImagePath4);
|
||
Makebar(pchar(Txt4), Length(Txt4), 3, 3, 0, PChar(fImagePath4), 3);
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
|
||
ExportFtErpFile(Trim(ADOQueryPrint.fieldbyname('LBName').AsString) + '.rmf', ADOQueryCmd);
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('LBName').AsString) + '.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RMVariables['QRBARCODE'] := fImagePath;
|
||
RMVariables['QRBARCODE1'] := fImagePath1;
|
||
RMVariables['QRBARCODE2'] := fImagePath2;
|
||
RMVariables['QRBARCODE3'] := fImagePath3;
|
||
RMVariables['QRBARCODE4'] := fImagePath4;
|
||
RMVariables['MJXH1'] := trim(Txt3);
|
||
RMVariables['FMPRTMF'] := StrToFloatDef(ADOQueryPrint.fieldbyname('MPRTMF').AsString, 0) / 100;
|
||
RM2.LoadFromFile(fPrintFile);
|
||
RM2.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1);
|
||
//RM2.ShowReport;
|
||
RM2.PrintReport;
|
||
end
|
||
else
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
//ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('LBName').AsString)), '<27><>ʾ', 0);
|
||
end;
|
||
sleep(500);
|
||
if Trim(ADOQueryPrint.fieldbyname('FBQName').AsString) <> '' then
|
||
begin
|
||
ExportFtErpFile(Trim(ADOQueryPrint.fieldbyname('FBQName').AsString) + '.rmf', ADOQueryCmd);
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('FBQName').AsString) + '.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RMVariables['QRBARCODE'] := fImagePath;
|
||
RMVariables['QRBARCODE1'] := fImagePath1;
|
||
RMVariables['QRBARCODE2'] := fImagePath2;
|
||
RMVariables['QRBARCODE4'] := fImagePath4;
|
||
RMVariables['MJXH1'] := '32' + copy(Label24.Caption, 3, 4) + formatdatetime('yyyyMMdd', ADOQueryPrint.fieldbyname('ZDDate').AsDateTime) + RightStr('10000' + Trim(ADOQueryPrint.fieldbyname('MJXH').AsString), 4);
|
||
RMVariables['FMPRTMF'] := StrToFloatDef(ADOQueryPrint.fieldbyname('MPRTMF').AsString, 0) / 100;
|
||
RM3.LoadFromFile(fPrintFile);
|
||
RM3.DefaultCopies := strtointdef(trim(ComboBox1.Text), 1);
|
||
//RM3.ShowReport;
|
||
RM3.PrintReport;
|
||
end
|
||
else
|
||
begin
|
||
BTPrint.Enabled := true;
|
||
//ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('FBQName').AsString)), '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.SavedataCK();
|
||
var
|
||
CRID: Integer;
|
||
MaxCkNo, MaxCkSubNo: string;
|
||
begin
|
||
//if Trim(Cds_Main.fieldbyname('SubType').AsString)='<27><><EFBFBD><EFBFBD>' then
|
||
//////////////////////////////////////////////////////////////<2F><><EFBFBD>浽<EFBFBD><E6B5BD><EFBFBD><EFBFBD>Ʒ<EFBFBD>ֿ<EFBFBD>////////////////////////////////////////////////
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.add('Update CK_BanCP_CRID Set CRID=CRID+1');
|
||
sql.Add('select * from CK_BanCP_CRID');
|
||
Open;
|
||
end;
|
||
CRID := ADOCmd.fieldbyname('CRID').Value;
|
||
if GetLSNo(ADOCmd, MaxCkNo, 'JR', 'CK_BanCP_CR', 5, 1) = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>Ʒ<EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_BanCP_CR where 1<>1');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('MainId').Value := Trim(FMainId);
|
||
FieldByName('SubId').Value := Trim(FSubId);
|
||
FieldByName('APID').Value := Trim(FAPID);
|
||
FieldByName('MJID').Value := Trim(CDS_MJID.fieldbyname('MJId').AsString);
|
||
FieldByName('BCID').Value := Trim(MaxCkNo);
|
||
FieldByName('CRTime').Value := SGetServerDateTime(ADOTmp);
|
||
FieldByName('CRFlag').Value := '<27><><EFBFBD><EFBFBD>';
|
||
FieldByName('CRType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
//FieldByName('JTType').Value:=Trim(XJFlag);
|
||
FieldByName('CRID').Value := CRID;
|
||
if Trim(MJMaoZ.Text) <> '' then
|
||
begin
|
||
FieldByName('KGQty').Value := StrToFloat(MJMaoZ.Text);
|
||
end;
|
||
if Trim(MJLen.Text) <> '' then
|
||
begin
|
||
FieldByName('Qty').Value := StrToFloat(MJLen.Text);
|
||
end;
|
||
FieldByName('QtyUnit').Value := Trim(Label9.Caption);
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('FillTime').Value := SGetServerDateTime(ADOTmp);
|
||
if Trim(Edit3.Text) <> '' then
|
||
begin
|
||
FieldByName('CPType').Value := '<27><>Ʒ';
|
||
end;
|
||
if Trim(Edit4.Text) <> '' then
|
||
begin
|
||
FieldByName('CPType').Value := '<27><>Ʒ';
|
||
end;
|
||
Post;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_BanCP_KC where 1<>1');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('CRID').Value := CRID;
|
||
FieldByName('BCID').Value := Trim(MaxCkNo);
|
||
FieldByName('MJID').Value := Trim(CDS_MJID.fieldbyname('MJID').AsString);
|
||
if Trim(MJMaoZ.Text) <> '' then
|
||
begin
|
||
FieldByName('KCKGQty').Value := StrToFloat(MJMaoZ.Text);
|
||
end;
|
||
if Trim(MJLen.Text) <> '' then
|
||
begin
|
||
FieldByName('KCQty').Value := StrToFloat(MJLen.Text);
|
||
end;
|
||
FieldByName('KCQtyUnit').Value := Trim(Label9.Caption);
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.BtnStatus(BSInt: Boolean);
|
||
begin
|
||
// Tv2.OptionsSelection.CellSelect:=BSInt;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.Tv2CDQtyPropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
try
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
if Trim(mvalue) <> '' then
|
||
begin
|
||
mvalue := '0';
|
||
end;
|
||
CDS_MJCD.Edit;
|
||
CDS_MJCD.FieldByName('CDQty').Value := mvalue;
|
||
except
|
||
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>֣<EFBFBD>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.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 TfrmMJManageNewFDNewSF.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 TfrmMJManageNewFDNewSF.SpeedButton13Click(Sender: TObject);
|
||
var
|
||
i: Integer;
|
||
begin
|
||
if Trim(Label24.Caption) = '' then
|
||
Exit;
|
||
if Label24.Visible = False then
|
||
Exit;
|
||
{with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Order_JYResult where APID='''+Trim(FAPID)+'''');
|
||
Open;
|
||
end;
|
||
if ADOTmp.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD><EFBFBD>δ¼<CEB4><C2BC>,<2C><><EFBFBD>ܼ<EFBFBD><DCBC><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
if Trim(CDS_MJCD.fieldbyname('MJID').AsString) <> '' then
|
||
begin
|
||
BTAdd.Click;
|
||
end;
|
||
if Trim(Label15.Caption) <> '' then
|
||
begin
|
||
//MJFK.Text:='';
|
||
//MJSJKZ.Text:='';
|
||
MJLen.Text := '';
|
||
MJMaoZ.Text := '';
|
||
MJQty1.Text := '';
|
||
//MJSJKZ.Text:='';
|
||
Label15.Caption := '';
|
||
|
||
end;
|
||
if Trim(FAPID) = '' then
|
||
Exit;
|
||
FCDName := Trim(TSpeedButton(Sender).Hint);
|
||
MovePanel1.Visible := True;
|
||
Label21.Caption := Trim(FCDName);
|
||
FInt := 11;
|
||
Edit1.SetFocus;
|
||
//CDQty.SetFocus;
|
||
Panel3.Visible := True;
|
||
PState := 1;
|
||
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 TfrmMJManageNewFDNewSF.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 TfrmMJManageNewFDNewSF.Button1Click(Sender: TObject);
|
||
var
|
||
mvalue: Double;
|
||
maxno: string;
|
||
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);
|
||
if Edit1.Text = '' then
|
||
FieldByName('CDbeg').Value := 0
|
||
else
|
||
FieldByName('CDbeg').Value := Trim(Edit1.Text);
|
||
if Edit2.Text = '' then
|
||
FieldByName('CDEnd').Value := 0
|
||
else
|
||
FieldByName('CDEnd').Value := Trim(Edit2.Text);
|
||
fieldbyname('CDReason').Value := trim(DName);
|
||
{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;
|
||
if CDQty.Text = '' then
|
||
FieldByName('CDQty').Value := 0
|
||
else
|
||
FieldByName('CDQty').Value := trim(CDQty.Text);
|
||
Post;
|
||
end;
|
||
Edit1.Text := '';
|
||
Edit2.Text := '';
|
||
CDQty.Text := '';
|
||
MovePanel1.Visible := False;
|
||
Panel3.Visible := False;
|
||
//if FInt=4 then
|
||
//begin
|
||
with CDS_MJCD do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(CDS_MJCD.fieldbyname('MCID').AsString) = '' then
|
||
begin
|
||
if GetLSNo(ADOCmd, 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(CDS_MJID.fieldbyname('MJID').AsString);
|
||
FieldByName('MCID').Value := Trim(maxno);
|
||
SSetSaveDataCDSNew(ADOCmd, Tv2, CDS_MJCD, 'WFB_MJJY_CD', 0);
|
||
Post;
|
||
end;
|
||
CDS_MJCD.Edit;
|
||
CDS_MJCD.FieldByName('MCID').Value := Trim(maxno);
|
||
|
||
Next;
|
||
end;
|
||
end;
|
||
//end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.Button4Click(Sender: TObject);
|
||
begin
|
||
Edit1.Text := '';
|
||
Edit2.Text := '';
|
||
CDQty.Text := '';
|
||
MovePanel1.Visible := False;
|
||
Panel3.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
//InitGrid();
|
||
InitJP();
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.Button5Click(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
i: Integer;
|
||
mvalue: Double;
|
||
begin
|
||
if CDS_MJID.IsEmpty then
|
||
Exit;
|
||
|
||
if PState <> 2 then
|
||
exit;
|
||
if trim(Label9.Caption) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ȵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Trim(MJQty1.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(MJQty1.Text, mvalue) = False then
|
||
begin
|
||
Application.MessageBox('ԭ<><D4AD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
if Trim(MJFK.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(MJFK.Text, mvalue) = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Trim(MJMaoZ.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(MJMaoZ.Text, mvalue) = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Trim(MJSJKZ.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(MJSJKZ.Text, mvalue) = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if Trim(MJQty2.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(MJQty2.Text, mvalue) = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if strtofloatdef(trim(MJQty4.Text), 0) < 0.00 then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>0<EFBFBD><30>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
if strtofloatdef(trim(MJLen.Text), 0) < 0.00 then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>С<EFBFBD><D0A1>0<EFBFBD><30>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
|
||
if SaveData() then
|
||
begin
|
||
MJLen.Text := '';
|
||
MJMaoZ.Text := '';
|
||
MJQty1.Text := '';
|
||
MJQty2.Text := '';
|
||
//MJSJKZ.Text:='';
|
||
Label15.Caption := '';
|
||
//MJQty3.Text:='';
|
||
MJQty4.Text := '';
|
||
Edit3.Text := '<27><>';
|
||
Edit4.Text := '';
|
||
Edit5.Text := '';
|
||
FInt := 0;
|
||
end;
|
||
if Trim(Edit6.Text) = '<27><>' then
|
||
begin
|
||
PrtData(FFFMJID);
|
||
end;
|
||
Label16.Caption := '';
|
||
BTAdd.Click;
|
||
Edit8.Text := '';
|
||
Button5.Visible := false;
|
||
MJLen.SetFocus;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.SpeedButton49Click(Sender: TObject);
|
||
begin
|
||
Panel3.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.APIDKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
fxsType := '';
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select C.Subid,A.*,B.MPRTBZNote,B.MPRTYaoFeng,B.MPRTTangJin,B.MPRTJiBenNote,B.MPRTTeBieNote,B.xs,B.xsType,B.MPRTKaiJian ');
|
||
sql.Add(',B.MPRTMF,B.MPRTKZ,isnull(B.LengUnit,E.OrderUnit) LengUnit,E.OrderUnit,B.SCYaoSu,B.BZNote,D.ConPerson2,D.conDefstr2,D.conDefstr3,D.ConNo,D.KHConNO,');
|
||
SQL.Add('OrderNoM=B.OrderNo,isnull(E.StyleNo,C.StyleNo) StyleNo,D.OrdDate,');
|
||
SQL.Add('PRTColor=isnull(E.PRTColor,E.PRTColorENG),B.MPrtCode, ');
|
||
SQL.Add('E.PRTHX,B.PiZhong,E.PRTColorNo,E.PRTColorEng,E.ZDJH,');
|
||
sql.Add('maxRoll=1+isnull((select cast (max(mjxh) as int) from WFB_MJJY X where X.subID=A.OrdsubIDCK ');
|
||
if ComBoBox2.Text = '<27><EFBFBD>' then
|
||
sql.Add(' and X.APID=A.SPID and isnull(X.MJStr4,'''')=''' + trim(MJStr4.Text) + '''');
|
||
sql.add('),0) ');
|
||
sql.Add('from CK_SXPB_CR A ');
|
||
SQL.Add('inner join JYOrder_Main B on A.OrdMainIDCK=B.MainId ');
|
||
sql.Add('left join JYOrder_Sub E on A.OrdSubidCK=E.Subid ');
|
||
sql.add('left join JYOrderCon_Sub C on C.Subid=A.ConCKID ');
|
||
sql.add('left join JYOrderCon_Main D on D.Mainid=C.Mainid ');
|
||
sql.Add('where A.SPID=''' + Trim(APID.Text) + '''');
|
||
// ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
if ADOTmp.IsEmpty = False then
|
||
begin
|
||
FOrdDate := ADOTmp.fieldbyname('OrdDate').AsDateTime;
|
||
Label2.Visible := True;
|
||
Label2.Caption := Trim(ADOTmp.fieldbyname('PRTHX').AsString);
|
||
Label9.Visible := True;
|
||
Label9.Caption := trim(ADOTmp.fieldbyname('LengUnit').AsString);
|
||
|
||
Label24.Visible := True;
|
||
Label24.Caption := Trim(ADOTmp.fieldbyname('OrderNoM').AsString);
|
||
Label25.Visible := True;
|
||
Label25.Caption := Trim(ADOTmp.fieldbyname('PRTColor').AsString);
|
||
Label43.Visible := true;
|
||
Label43.Caption := Trim(ADOTmp.fieldbyname('PRTColorEng').AsString);
|
||
FAPID := Trim(APID.Text);
|
||
FMainId := Trim(ADOTmp.fieldbyname('OrdMainIDCK').AsString);
|
||
FSubId := Trim(ADOTmp.fieldbyname('OrdsubIDCK').AsString);
|
||
FZDJH := StrToFloatDef(ADOTmp.fieldbyname('ZDJH').AsString, 0);
|
||
FOrderUnit := trim(ADOTmp.fieldbyname('OrderUnit').AsString);
|
||
FConPerson2 := Trim(ADOTmp.fieldbyname('ConPerson2').AsString);
|
||
FconDefstr2 := Trim(ADOTmp.fieldbyname('conDefstr2').AsString);
|
||
FconDefstr3 := Trim(ADOTmp.fieldbyname('conDefstr3').AsString);
|
||
FConNo := Trim(ADOTmp.fieldbyname('ConNo').AsString);
|
||
FKHConNO := Trim(ADOTmp.fieldbyname('KHConNO').AsString);
|
||
FStyleNo := trim(ADOTmp.fieldbyname('StyleNo').AsString);
|
||
FConID := trim(ADOTmp.fieldbyname('Subid').AsString);
|
||
FMPrtCode := Trim(ADOTmp.fieldbyname('MPrtCode').AsString);
|
||
MJXH.Text := Trim(ADOTmp.fieldbyname('maxRoll').AsString);
|
||
MKXS.Text := Trim(ADOTmp.fieldbyname('Xs').AsString);
|
||
MJstr4.Text := Trim(ADOTmp.fieldbyname('RCgangNO').AsString);
|
||
fxsType := Trim(ADOTmp.fieldbyname('xsType').AsString);
|
||
AOrdDefNote1.Text := '<27><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>:' + Trim(ADOTmp.fieldbyname('Note').AsString) + #13 + '<27>ŷ<EFBFBD>:' + Trim(ADOTmp.fieldbyname('MPRTMF').AsString) + #13 + '<27><><EFBFBD><EFBFBD>:' + Trim(ADOTmp.fieldbyname('MPRTKZ').AsString) + #13 + '<27><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>:' + Trim(ADOTmp.fieldbyname('SCYaoSu').AsString) + #13 + '<27><>װҪ<D7B0><D2AA>:' + Trim(ADOTmp.fieldbyname('BZNote').AsString);
|
||
if ADOTmp.fieldbyname('PiZhong').AsFloat = 0 then
|
||
MJQty3.Text := ''
|
||
else
|
||
MJQty3.Text := Trim(ADOTmp.fieldbyname('PiZhong').AsString);
|
||
Label19.Caption := Label9.Caption;
|
||
Label20.Caption := Label9.Caption;
|
||
Label7.Caption := Label9.Caption;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Label2.Visible := False;
|
||
Label2.Caption := '';
|
||
APID.Text := '';
|
||
FAPID := '';
|
||
FMainId := '';
|
||
FSubId := '';
|
||
AOrdDefNote1.Text := '';
|
||
Exit;
|
||
end;
|
||
|
||
APID.Text := '';
|
||
BTAdd.Click;
|
||
BTPrint.Enabled := true;
|
||
MJLen.SetFocus;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.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 TfrmMJManageNewFDNewSF.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;
|
||
if trim(MKXS.Text) = '' then
|
||
exit;
|
||
CDQty.Text := FloatToStr(StrToFloat(Edit2.Text) * strtofloat(MKXS.Text));
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.Edit3Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit3.Text) = '' then
|
||
begin
|
||
Edit3.Text := '<27><>';
|
||
Edit4.Text := '';
|
||
Edit5.Text := '';
|
||
end
|
||
else
|
||
begin
|
||
Edit3.Text := '';
|
||
Edit4.Text := '<27><>';
|
||
Edit5.Text := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.Edit4Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit4.Text) = '' then
|
||
begin
|
||
Edit4.Text := '<27><>';
|
||
Edit3.Text := '';
|
||
Edit5.Text := '';
|
||
end
|
||
else
|
||
begin
|
||
Edit4.Text := '';
|
||
Edit3.Text := '<27><>';
|
||
Edit5.Text := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.Edit5Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit5.Text) = '' then
|
||
begin
|
||
Edit5.Text := '<27><>';
|
||
Edit3.Text := '';
|
||
Edit4.Text := '';
|
||
end
|
||
else
|
||
begin
|
||
Edit5.Text := '';
|
||
Edit3.Text := '<27><>';
|
||
Edit4.Text := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.Edit6Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit6.Text) = '' then
|
||
begin
|
||
Edit6.Text := '<27><>';
|
||
end
|
||
else
|
||
begin
|
||
Edit6.Text := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MJstr3KeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
Key := #0;
|
||
SelectNext(ActiveControl as TWinControl, True, True);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MJQty3Exit(Sender: TObject);
|
||
begin
|
||
{ if (trim(MJMaoZ.Text)='') and (trim(MJQty4.Text)='') then exit;
|
||
if (trim(MJMaoZ.Text)='') and (trim(MJQty3.Text)='') then exit;
|
||
if (trim(MJQty4.Text)='') and (trim(MJQty3.Text)='') then exit;
|
||
|
||
if (trim(MJQty3.Text)='') then exit;
|
||
|
||
if (trim(MJQty4.Text)<>'') then
|
||
begin
|
||
MJMaoZ.Text:=floattostr(strtofloatdef(trim(MJQty3.Text),0)+strtofloatdef(trim(MJQty4.Text),0) );
|
||
exit;
|
||
end;
|
||
}
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MJMaoZExit(Sender: TObject);
|
||
begin
|
||
{ if (trim(MJMaoZ.Text)='') and (trim(MJQty4.Text)='') then exit;
|
||
if (trim(MJMaoZ.Text)='') and (trim(MJQty3.Text)='') then exit;
|
||
if (trim(MJQty4.Text)='') and (trim(MJQty3.Text)='') then exit;
|
||
|
||
if (trim(MJQty3.Text)='') then exit;
|
||
|
||
if (trim(MJMaoZ.Text)<>'') then
|
||
begin
|
||
MJQty4.Text:=floattostr(strtofloatdef(trim(MJMaoZ.Text),0)-strtofloatdef(trim(MJQty3.Text),0) );
|
||
exit;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.Label9Click(Sender: TObject);
|
||
begin
|
||
{if application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>','<27><>ʾ',1)=2 then exit;
|
||
if trim(Label9.Caption)='M' then
|
||
begin
|
||
Label9.Caption:='Y';
|
||
//Label19.Caption:='Y';
|
||
//Label20.Caption:='Y';
|
||
Label7.Caption:='Y';
|
||
end
|
||
else
|
||
begin
|
||
Label9.Caption:='M';
|
||
//Label19.Caption:='M';
|
||
//Label20.Caption:='M';
|
||
Label7.Caption:='M';
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MJLenExit(Sender: TObject);
|
||
begin
|
||
MJQty3.OnExit(self);
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MJQty4Exit(Sender: TObject);
|
||
begin
|
||
if (trim(MJMaoZ.Text) = '') and (trim(MJQty4.Text) = '') then
|
||
exit;
|
||
if (trim(MJMaoZ.Text) = '') and (trim(MJQty3.Text) = '') then
|
||
exit;
|
||
if (trim(MJQty4.Text) = '') and (trim(MJQty3.Text) = '') then
|
||
exit;
|
||
|
||
if (trim(MJQty3.Text) = '') then
|
||
exit;
|
||
|
||
if (trim(MJQty4.Text) <> '') then
|
||
begin
|
||
MJMaoZ.Text := floattostr(strtofloatdef(trim(MJQty3.Text), 0) + strtofloatdef(trim(MJQty4.Text), 0));
|
||
exit;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.Button2Click(Sender: TObject);
|
||
begin
|
||
RadioGroup1.ItemIndex := -1;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MJQty4Change(Sender: TObject);
|
||
var
|
||
FReal: Double;
|
||
begin
|
||
if Trim(MJQty4.Text) = '' then
|
||
begin
|
||
// MJLen.Text:='';
|
||
MJMaoZ.Text := '';
|
||
Exit;
|
||
end;
|
||
if TryStrToFloat(MJQty4.Text, FReal) = False then
|
||
Exit;
|
||
if Trim(MJQty3.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(MJQty3.Text, FReal) = True then
|
||
MJMaoZ.Text := FloatToStr(StrToFloat(MJQty4.Text) + StrToFloat(MJQty3.Text));
|
||
end
|
||
else
|
||
begin
|
||
MJMaoZ.Text := MJQty4.Text;
|
||
end;
|
||
|
||
if trim(fxsType) = '<27><><EFBFBD>ػ<EFBFBD><D8BB>㳤<EFBFBD><E3B3A4>' then
|
||
begin
|
||
if MKXS.Text <> '0' then
|
||
begin
|
||
MJLen.Text := format('%.1f', [StrToFloatdef(trim(MJQty4.Text), 0) * StrToFloatdef(trim(MKXS.Text), 0)]);
|
||
//MJMaoZ.Text:=FloatToStr(StrToFloatdef(trim(MJQty4.Text),0)+StrToFloatdef(trim(MJQty3.Text),0));
|
||
end
|
||
else
|
||
begin
|
||
MJLen.Text := format('%.0f', [StrToFloatdef(trim(MJQty4.Text), 0) * StrToFloatdef(trim(MKXS.Text), 0)]);
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MJMaoZChange(Sender: TObject);
|
||
var
|
||
FReal: Double;
|
||
begin
|
||
//if StrToFloat(MJSJKZ.Text)*StrToFloat(MJFK.Text)=0 then Exit;
|
||
if Trim(MJMaoZ.Text) = '' then
|
||
begin
|
||
//MJLen.Text:='';
|
||
MJQty4.Text := '';
|
||
Exit;
|
||
end;
|
||
if TryStrToFloat(MJMaoZ.Text, FReal) = False then
|
||
Exit;
|
||
if Trim(MJQty3.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(MJQty3.Text, FReal) = False then
|
||
Exit;
|
||
MJQty4.Text := FloatToStr(StrToFloat(MJMaoZ.Text) - StrToFloat(MJQty3.Text));
|
||
end
|
||
else
|
||
begin
|
||
MJQty4.Text := MJMaoZ.Text;
|
||
end;
|
||
if trim(fxsType) = '<27><><EFBFBD>ػ<EFBFBD><D8BB>㳤<EFBFBD><E3B3A4>' then
|
||
begin
|
||
if MKXS.Text <> '0' then
|
||
begin
|
||
MJLen.Text := format('%.1f', [StrToFloatdef(trim(MJQty4.Text), 0) * StrToFloatdef(trim(MKXS.Text), 0)]);
|
||
// MJMaoZ.Text:=FloatToStr(StrToFloatdef(trim(MJQty4.Text),0)+StrToFloatdef(trim(MJQty3.Text),0));
|
||
end
|
||
else
|
||
begin
|
||
MJLen.Text := format('%.0f', [StrToFloatdef(trim(MJQty4.Text), 0) * StrToFloatdef(trim(MKXS.Text), 0)]);
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.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 TfrmMJManageNewFDNewSF.Button3Click(Sender: TObject);
|
||
begin
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select C.Subid,A.*,B.MPRTBZNote,B.MPRTYaoFeng,B.MPRTTangJin,B.MPRTJiBenNote,B.MPRTTeBieNote,B.xs,B.xsType,B.MPRTKaiJian ');
|
||
sql.Add(',B.MPRTMF,B.MPRTKZ,B.LengUnit,B.SCYaoSu,B.BZNote,C.StyleNo,');
|
||
SQL.Add('OrderNoM=(select OrderNo from JYOrder_Main X where X.Mainid=A.OrdMainIDCK),');
|
||
SQL.Add('isnull(E.PRTHX,E.PRTColorNo) PRTHX,E.PRTColorNo,');
|
||
sql.Add('PiZhong=(select PiZhong from JYOrder_Main X where X.Mainid=A.OrdMainIDCK),');
|
||
sql.Add('maxRoll=1+isnull((select cast (max(mjxh) as int) from WFB_MJJY X where X.subID=A.OrdsubIDCK and X.MJStr4=A.RCGangNo),0)');
|
||
sql.Add('from CK_SXPB_CR A');
|
||
SQL.Add('inner join JYOrder_Main B on A.OrdMainIDCK=B.MainId');
|
||
sql.Add(' left join JYOrder_Sub C on C.Subid=A.OrdSubidCK ');
|
||
sql.Add('where SPID=''' + Trim(APID.Text) + '''');
|
||
Open;
|
||
end;
|
||
if ADOTmp.IsEmpty = False then
|
||
begin
|
||
Label2.Visible := True;
|
||
Label2.Caption := Trim(ADOTmp.fieldbyname('PRTHX').AsString);
|
||
Label9.Visible := True;
|
||
Label9.Caption := Trim(ADOTmp.fieldbyname('LengUnit').AsString);
|
||
Label24.Visible := True;
|
||
Label24.Caption := Trim(ADOTmp.fieldbyname('OrderNoM').AsString);
|
||
Label25.Visible := True;
|
||
Label25.Caption := Trim(ADOTmp.fieldbyname('PRTColor').AsString);
|
||
FAPID := Trim(APID.Text);
|
||
FStyleNo := Trim(ADOTmp.fieldbyname('StyleNo').AsString);
|
||
FMainId := Trim(ADOTmp.fieldbyname('MainId').AsString);
|
||
FSubId := Trim(ADOTmp.fieldbyname('SubId').AsString);
|
||
MJXH.Text := Trim(ADOTmp.fieldbyname('maxRoll').AsString);
|
||
AOrdDefNote1.Text := '<27><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>:' + Trim(ADOTmp.fieldbyname('Note').AsString) + #13 + '<27>ŷ<EFBFBD>:' + Trim(ADOTmp.fieldbyname('MPRTMF').AsString) + #13 + '<27><><EFBFBD><EFBFBD>:' + Trim(ADOTmp.fieldbyname('MPRTKZ').AsString) + #13 + '<27><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>:' + Trim(ADOTmp.fieldbyname('SCYaoSu').AsString) + #13 + '<27><>װҪ<D7B0><D2AA>:' + Trim(ADOTmp.fieldbyname('BZNote').AsString);
|
||
if ADOTmp.fieldbyname('PiZhong').AsFloat = 0 then
|
||
MJQty3.Text := ''
|
||
else
|
||
MJQty3.Text := Trim(ADOTmp.fieldbyname('PiZhong').AsString);
|
||
Label13.Caption := Trim(ADOTmp.fieldbyname('AOrddefstr2').AsString);
|
||
MJFK.Text := Trim(ADOTmp.fieldbyname('JYMF').AsString);
|
||
MJSJKZ.Text := Trim(ADOTmp.fieldbyname('JYKZ').AsString);
|
||
MKXS.Text := Trim(ADOTmp.fieldbyname('ZSXS').AsString);
|
||
MJstr4.Text := Trim(ADOTmp.fieldbyname('RCGangNo').AsString);
|
||
Label19.Caption := Label9.Caption;
|
||
Label20.Caption := Label9.Caption;
|
||
Label7.Caption := Label9.Caption;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Label2.Visible := False;
|
||
Label2.Caption := '';
|
||
APID.Text := '';
|
||
FAPID := '';
|
||
FMainId := '';
|
||
FSubId := '';
|
||
AOrdDefNote1.Text := '';
|
||
MJStr4.Text := '';
|
||
Exit;
|
||
end;
|
||
// MJXH.Text:='1';
|
||
APID.Text := '';
|
||
BTAdd.Click;
|
||
MJMaoZ.SetFocus;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MJFKChange(Sender: TObject);
|
||
var
|
||
FReal: Double;
|
||
begin
|
||
// if StrToFloat(MJSJKZ.Text)*StrToFloat(MJFK.Text)=0 then Exit;
|
||
|
||
if TryStrToFloat(MJQty4.Text, FReal) = False then
|
||
Exit;
|
||
if Trim(MJSJKZ.Text) = '' then
|
||
Exit;
|
||
if TryStrToFloat(MJSJKZ.Text, FReal) = False then
|
||
begin
|
||
Exit;
|
||
end;
|
||
if Trim(MJFK.Text) = '' then
|
||
Exit;
|
||
if TryStrToFloat(MJFK.Text, FReal) = False then
|
||
begin
|
||
Exit;
|
||
end;
|
||
if StrToFloat(MJSJKZ.Text) * StrToFloat(MJFK.Text) = 0 then
|
||
Exit;
|
||
{ IF trim(MKXS.Text)='' then
|
||
begin
|
||
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)]);
|
||
end else
|
||
begin
|
||
MJLen.Text:=format('%.1f',[StrToFloat(MJQty4.Text)*1000*100/StrToFloat(MJSJKZ.Text)/StrToFloat(MJFK.Text)*1.0936]);
|
||
//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 TfrmMJManageNewFDNewSF.Edit7Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit7.Text) = '' then
|
||
begin
|
||
Edit7.Text := '<27><>';
|
||
// if not IsCommOpen then OpenCom(DllName);
|
||
IsJsMessage := true;
|
||
end
|
||
else
|
||
begin
|
||
Edit7.Text := '';
|
||
IsJsMessage := true;
|
||
MJMaoZ.Text := '0';
|
||
MJQty4.Text := '0';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.Button6Click(Sender: TObject);
|
||
begin
|
||
frmClothHCList := TfrmClothHCList.create(self);
|
||
with frmClothHCList do
|
||
begin
|
||
fType := '10';
|
||
if showmodal = 1 then
|
||
begin
|
||
APID.Text := trim(Order_Main.fieldbyname('APID').asstring);
|
||
Button3.Click;
|
||
end;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MJQty4KeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
BTPrint.Click;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MKXSChange(Sender: TObject);
|
||
begin
|
||
if Trim(MJQty3.Text) = '' then
|
||
begin
|
||
Exit;
|
||
end;
|
||
if trim(MJMaoZ.Text) = '' then
|
||
begin
|
||
exit;
|
||
end;
|
||
if trim(MKXS.Text) = '' then
|
||
begin
|
||
exit;
|
||
end;
|
||
MJQty4.Text := FloatToStr(StrToFloat(MJMaoZ.Text) - StrToFloat(MJQty3.Text));
|
||
MJLen.Text := format('%.1f', [StrToFloatdef(trim(MJQty4.Text), 0) * StrToFloatdef(trim(MKXS.Text), 0)]);
|
||
//MJQty4.Text:=format('%.1f',[StrToFloatdef(trim(MJLen.Text),0)* StrToFloatdef(trim(MKXS.Text),0)]);
|
||
//MJMaoZ.Text:=FloatToStr(StrToFloat(MJQty4.Text)+StrToFloat(MJQty3.Text));
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.FormCreate(Sender: TObject);
|
||
begin
|
||
IsCommopen := false;
|
||
IsJsMessage := false;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MJQty2Change(Sender: TObject);
|
||
var
|
||
FReal: double;
|
||
begin
|
||
{IF trim(fxsType)='<27><><EFBFBD>ػ<EFBFBD><D8BB>㳤<EFBFBD><E3B3A4>'then
|
||
begin
|
||
if MKXS.Text<>'0' then
|
||
begin
|
||
MJLen.Text:=format('%.0f',[StrToFloatdef(trim(MJQty4.Text),0)* StrToFloatdef(trim(MKXS.Text),0)]);
|
||
// MJMaoZ.Text:=FloatToStr(StrToFloatdef(trim(MJQty4.Text),0)+StrToFloatdef(trim(MJQty3.Text),0));
|
||
end;
|
||
end; }
|
||
if trim(MKXS.Text) <> '' then
|
||
begin
|
||
if TryStrToFloat(MKXS.Text, FReal) = true then
|
||
begin
|
||
MJLen.Text := format('%.0f', [StrToFloatdef(trim(MJQty4.Text), 0) * StrToFloatdef(trim(MKXS.Text), 0)]);
|
||
MJLen.Text := format('%.0f', [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 := format('%.0f', [StrToFloat(MJQty4.Text) * 1000 * 100 / StrToFloat(MJSJKZ.Text) / StrToFloat(MJFK.Text)]);
|
||
MJLen.Text := format('%.0f', [StrToFloatdef(trim(MJLen.Text), 0) - StrToFloatdef(trim(MJQty2.Text), 0)]);
|
||
end
|
||
else
|
||
begin
|
||
MJLen.Text := format('%.0f', [StrToFloat(MJQty4.Text) * 1000 * 100 / StrToFloat(MJSJKZ.Text) / StrToFloat(MJFK.Text) * 1.0936]);
|
||
MJLen.Text := format('%.0f', [StrToFloatdef(trim(MJLen.Text), 0) - StrToFloatdef(trim(MJQty2.Text), 0)]);
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.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 TfrmMJManageNewFDNewSF.MJLenChange(Sender: TObject);
|
||
begin
|
||
if trim(fxsType) = '<27><><EFBFBD>Ȼ<EFBFBD><C8BB>㾻<EFBFBD><E3BEBB>' then
|
||
begin
|
||
MJQty4.Text := format('%.1f', [StrToFloatdef(trim(MJLen.Text), 0) * StrToFloatdef(trim(MKXS.Text), 0)]);
|
||
MJMaoZ.Text := FloatToStr(StrToFloatdef(trim(MJQty4.Text), 0) + StrToFloatdef(trim(MJQty3.Text), 0));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.tv2CDWZPropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
try
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
if Trim(mvalue) <> '' then
|
||
begin
|
||
mvalue := '0';
|
||
end;
|
||
CDS_MJCD.Edit;
|
||
CDS_MJCD.FieldByName('CDBeg').Value := mvalue;
|
||
except
|
||
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>֣<EFBFBD>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.v2Column2PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
try
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
if Trim(mvalue) <> '' then
|
||
begin
|
||
mvalue := '0';
|
||
end;
|
||
CDS_MJCD.Edit;
|
||
CDS_MJCD.FieldByName('CDend').Value := mvalue;
|
||
except
|
||
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>֣<EFBFBD>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.Tv3CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
{if application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD>','<27><>ʾ',1)=2 then exit;
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_BanCP_CR where MJID='''+Trim(CDS_MJID.fieldbyname('MJID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
if ADOTmp.IsEmpty=False then
|
||
begin
|
||
CDS_MJID.EnableControls;
|
||
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!','<27><>ʾ',0);
|
||
Exit;
|
||
end else
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete WFB_MJJY where MJID='''+Trim(CDS_MJID.fieldbyname('MJID').AsString)+'''');
|
||
sql.Add('delete WFB_MJJY_CD where MJID='''+Trim(CDS_MJID.fieldbyname('MJID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
CDS_MJID.Delete;}
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.Button7Click(Sender: TObject);
|
||
begin
|
||
if CDS_MJID.IsEmpty then
|
||
exit;
|
||
with CDS_MJID do
|
||
begin
|
||
first;
|
||
while not eof do
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update WFB_MJJY set WCStatus=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
sql.add('where MJID=''' + trim(CDS_MJID.fieldbyname('MJID').asstring) + '''');
|
||
execsql;
|
||
end;
|
||
with CDS_MJID do
|
||
begin
|
||
edit;
|
||
fieldbyname('WCStatus').AsString := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
end;
|
||
next;
|
||
end;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>', '<27><>ʾ');
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MJXHCXChange(Sender: TObject);
|
||
begin
|
||
//SDofilter10(CDS_MJID,SGetFilters(Panel1,1,2));
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.MJXHCXClick(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 TfrmMJManageNewFDNewSF.Edit10Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit10.Text) = '' then
|
||
begin
|
||
Edit10.Text := '<27><>';
|
||
end
|
||
else
|
||
begin
|
||
Edit10.Text := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDNewSF.Edit11Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit11.Text) = '' then
|
||
begin
|
||
Edit11.Text := '<27><>';
|
||
// if not IsCommOpen then OpenCom(DllName);
|
||
IsJsMessage := true;
|
||
end
|
||
else
|
||
begin
|
||
Edit11.Text := '';
|
||
IsJsMessage := true;
|
||
MJLen.Text := '0';
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|