2352 lines
61 KiB
ObjectPascal
2352 lines
61 KiB
ObjectPascal
unit U_MJManageNewFDJJAP;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, StdCtrls, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||
cxDataStorage, cxEdit, DB, cxDBData, cxCalendar, cxGridLevel,
|
||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
||
cxControls, cxGridCustomView, cxGrid, RM_Common, RM_Class, RM_GridReport,
|
||
RM_System, RM_Dataset, ADODB, DBClient, cxGridCustomPopupMenu, cxGridPopupMenu,
|
||
ExtCtrls, ComCtrls, ToolWin, cxTextEdit, Buttons, cxSplitter, cxCheckBox,
|
||
MovePanel, IniFiles, Math, cxLookAndFeels, cxLookAndFeelPainters,
|
||
dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel,
|
||
dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle,
|
||
dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans,
|
||
dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky,
|
||
dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
||
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
||
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
||
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
||
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
|
||
dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin,
|
||
dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus,
|
||
dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
|
||
dxSkinTheAsphaltWorld, dxSkinsDefaultPainters, dxSkinValentine,
|
||
dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue, dxSkinscxPCPainter,
|
||
cxNavigator;
|
||
{function CommOpen(fhandle:hwnd;sCommName:PAnsiChar;
|
||
IntTime:integer):integer;stdcall;external 'JCYData.DLL';
|
||
function CommClose(sCommName:PAnsiChar):integer;stdcall;external 'JCYData.DLL'; }
|
||
|
||
function CommOpen(fhandle: hwnd; sCommName: PAnsiChar; IntTime: integer; IsMessage: integer): integer; stdcall; external 'JZCRS232D.dll';
|
||
|
||
function CommClose(sCommName: PAnsiChar): integer; stdcall; external 'JZCRS232D.dll';
|
||
|
||
type
|
||
TfrmMJManageNewFDJJAP = class(TForm)
|
||
cxStyleRepository1: TcxStyleRepository;
|
||
cxStyle1: TcxStyle;
|
||
cxStyle2: TcxStyle;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
DataSource1: TDataSource;
|
||
Order_MJ: TClientDataSet;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOCmd: TADOQuery;
|
||
ADOTmp: TADOQuery;
|
||
RMDB_Main: TRMDBDataSet;
|
||
RM2: TRMGridReport;
|
||
ToolBar1: TToolBar;
|
||
TBClose: TToolButton;
|
||
DataSource2: TDataSource;
|
||
CDS_MJCD: TClientDataSet;
|
||
DataSource3: TDataSource;
|
||
CDS_MJID: TClientDataSet;
|
||
Timer1: TTimer;
|
||
ADOQueryPrint: TADOQuery;
|
||
ToolButton1: TToolButton;
|
||
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;
|
||
Panel1: TPanel;
|
||
BTAdd: TButton;
|
||
BTEdit: TButton;
|
||
Label16: TLabel;
|
||
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;
|
||
Label4: TLabel;
|
||
MJMaoZ: TEdit;
|
||
Label11: TLabel;
|
||
BTPrint: TButton;
|
||
Edit3: TEdit;
|
||
Label10: TLabel;
|
||
Edit4: TEdit;
|
||
Label12: TLabel;
|
||
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;
|
||
Label28: TLabel;
|
||
Edit5: TEdit;
|
||
Label37: TLabel;
|
||
Edit13: TEdit;
|
||
Label1: TLabel;
|
||
Panel4: TPanel;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
tv2CDType: TcxGridDBColumn;
|
||
tv2CDWZ: TcxGridDBColumn;
|
||
v2Column2: TcxGridDBColumn;
|
||
Tv2CDQty: TcxGridDBColumn;
|
||
Tv2CDReason: TcxGridDBColumn;
|
||
v2Column1: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
cxGrid3: TcxGrid;
|
||
Tv3: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
v3Column1: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
Label22: TLabel;
|
||
Label24: TLabel;
|
||
JBZhuanQty: TEdit;
|
||
Panel5: TPanel;
|
||
Label27: TLabel;
|
||
APID: TEdit;
|
||
Button2: TButton;
|
||
ConNo: TEdit;
|
||
Label26: TLabel;
|
||
MJPiZ: TEdit;
|
||
Label30: TLabel;
|
||
www: TLabel;
|
||
MJJingZ: TEdit;
|
||
v3Column3: TcxGridDBColumn;
|
||
Label31: TLabel;
|
||
Label3: TLabel;
|
||
Label6: TLabel;
|
||
ClothType: TComboBox;
|
||
CDS_Print: TClientDataSet;
|
||
v2Column3: TcxGridDBColumn;
|
||
JXPerson: TEdit;
|
||
JBSCPerson: TEdit;
|
||
Button6: TButton;
|
||
Label5: TLabel;
|
||
JBSCPerson2: TEdit;
|
||
Button7: TButton;
|
||
Label33: TLabel;
|
||
Edit6: TEdit;
|
||
Label9: TLabel;
|
||
JBZhuanQty2: TEdit;
|
||
Label14: TLabel;
|
||
JBStr: TEdit;
|
||
Label19: TLabel;
|
||
houdang: TEdit;
|
||
Button8: TButton;
|
||
YJQtyKg: TEdit;
|
||
YJQtyM: TEdit;
|
||
Label23: TLabel;
|
||
Label34: TLabel;
|
||
Label38: TLabel;
|
||
LBRQ: TDateTimePicker;
|
||
LBXS: TEdit;
|
||
LBFZ: TEdit;
|
||
Label39: TLabel;
|
||
Label40: TLabel;
|
||
Label41: TLabel;
|
||
GCCode: TEdit;
|
||
Label42: TLabel;
|
||
Label43: TLabel;
|
||
Label45: TLabel;
|
||
MJKJZ: TEdit;
|
||
Label29: TLabel;
|
||
v3Column4: TcxGridDBColumn;
|
||
APBatchNo: TEdit;
|
||
Label46: TLabel;
|
||
Label20: TLabel;
|
||
v2Column4: TcxGridDBColumn;
|
||
Label47: TLabel;
|
||
WzZhuanQty: TEdit;
|
||
Label2: TLabel;
|
||
SCPerson: TEdit;
|
||
Button3: TButton;
|
||
WorkShift: TComboBox;
|
||
Label49: TLabel;
|
||
QryCheckNet: TADOQuery;
|
||
MovePanel1: TMovePanel;
|
||
Label21: TLabel;
|
||
Label7: TLabel;
|
||
Label8: TLabel;
|
||
Label17: TLabel;
|
||
Label18: TLabel;
|
||
Label44: TLabel;
|
||
Button1: TButton;
|
||
Button4: TButton;
|
||
CDQty: TEdit;
|
||
CDGS: TEdit;
|
||
CDKgQty: TEdit;
|
||
ZZPerson: TEdit;
|
||
Button5: TButton;
|
||
chkIsYj: TCheckBox;
|
||
v2Column5: TcxGridDBColumn;
|
||
lbl1: TLabel;
|
||
YJZP: TEdit;
|
||
Panel7: TPanel;
|
||
Label50: TLabel;
|
||
LabQty: TLabel;
|
||
Label51: TLabel;
|
||
LabQQty: TLabel;
|
||
Label52: TLabel;
|
||
LabChouZhen: TLabel;
|
||
lblJYPS: TLabel;
|
||
Panel8: TPanel;
|
||
Label53: TLabel;
|
||
Label54: TLabel;
|
||
edtSCAPID: TEdit;
|
||
Label55: TLabel;
|
||
Label56: TLabel;
|
||
lbl2: TLabel;
|
||
Timer2: TTimer;
|
||
Edit2: TEdit;
|
||
Label15: TLabel;
|
||
Label36: TLabel;
|
||
Label25: TLabel;
|
||
Label48: TLabel;
|
||
Edit12: TEdit;
|
||
Edit7: TEdit;
|
||
Edit1: TEdit;
|
||
Label57: TLabel;
|
||
v3Column5: TcxGridDBColumn;
|
||
Label58: TLabel;
|
||
CARNO: TEdit;
|
||
LBPiKgQty: TLabel;
|
||
Label13: TLabel;
|
||
Label59: TLabel;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure Tv2CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
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 SpeedButton49Click(Sender: TObject);
|
||
procedure YJQtyKgClick(Sender: TObject);
|
||
procedure Edit2Change(Sender: TObject);
|
||
procedure Edit3Click(Sender: TObject);
|
||
procedure Edit4Click(Sender: TObject);
|
||
procedure Edit5Click(Sender: TObject);
|
||
procedure Label9DblClick(Sender: TObject);
|
||
procedure CDQtyClick(Sender: TObject);
|
||
procedure Edit10Click(Sender: TObject);
|
||
procedure Edit12Click(Sender: TObject);
|
||
procedure ConNoChange(Sender: TObject);
|
||
procedure JBStrClick(Sender: TObject);
|
||
procedure Edit7Click(Sender: TObject);
|
||
procedure APIDClick(Sender: TObject);
|
||
procedure APIDKeyPress(Sender: TObject; var Key: Char);
|
||
procedure Button2Click(Sender: TObject);
|
||
procedure Edit13Click(Sender: TObject);
|
||
procedure MJPiZChange(Sender: TObject);
|
||
procedure MJMaoZChange(Sender: TObject);
|
||
procedure Edit6Click(Sender: TObject);
|
||
procedure Button3Click(Sender: TObject);
|
||
procedure Button5Click(Sender: TObject);
|
||
procedure Button6Click(Sender: TObject);
|
||
procedure Button7Click(Sender: TObject);
|
||
procedure Button8Click(Sender: TObject);
|
||
procedure MJKJZChange(Sender: TObject);
|
||
procedure Edit1Click(Sender: TObject);
|
||
procedure ZZPersonKeyPress(Sender: TObject; var Key: Char);
|
||
procedure MJMaoZKeyPress(Sender: TObject; var Key: Char);
|
||
procedure SCPersonKeyPress(Sender: TObject; var Key: Char);
|
||
procedure edtSCAPIDKeyPress(Sender: TObject; var Key: Char);
|
||
procedure Timer2Timer(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
FInt, PState, PrintInt, SCInitGrid, FState, FCK: Integer;
|
||
FColumn, FBanZu, FAPID, FMainId, FSubId: string;
|
||
MValue, FCDName, DZCDYDllName, MBDYDllName: string;
|
||
Flogo: string;
|
||
fjs: Integer;
|
||
procedure InitConNo();
|
||
procedure InitSCPerson();
|
||
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 On1201(var Message: Tmessage); message 1201;
|
||
procedure OpenCom(DllName: string);
|
||
procedure CloseCom(DllName: string);
|
||
procedure InitDataJM();
|
||
procedure PrintData(FFFMJID: string);
|
||
function SelfConnData(): Boolean;
|
||
function CheckData(): Boolean;
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmMJManageNewFDJJAP: TfrmMJManageNewFDJJAP;
|
||
newh, newh1: hwnd;
|
||
IniFile: TIniFile;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_ZDYHelp, U_iniParam, U_SCPerson, U_SCPersonAA;
|
||
|
||
{$R *.dfm}
|
||
function TfrmMJManageNewFDJJAP.CheckData(): Boolean;
|
||
var
|
||
mvalue: double;
|
||
begin
|
||
try
|
||
if Trim(FMainId) = '' then
|
||
raise Exception.Create('<27><>ɨ<EFBFBD>貼Ʊ<E8B2BC><C6B1>');
|
||
// if Flogo <> 'GY' then
|
||
// begin
|
||
// if Trim(SCPerson.Text) = '' then
|
||
// raise Exception.Create('û<><C3BB>ѡ<EFBFBD><EFBFBD><F1B5B2B3><EFBFBD><EFBFBD><EFBFBD>');
|
||
// end;
|
||
if Trim(ConNo.Text) = '' then
|
||
raise Exception.Create('û<><C3BB>ɨ<EFBFBD>裡');
|
||
if Trim(WorkShift.Text) = '' then
|
||
raise Exception.Create('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>Σ<EFBFBD>');
|
||
if Trim(CarNo.Text) = '' then
|
||
raise Exception.Create('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>̨<EFBFBD><CCA8>');
|
||
// if Trim(ClothType.Text) = '' then
|
||
// raise Exception.Create('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD>');
|
||
if TryStrToFloat(MJMaoZ.Text, mvalue) = False then
|
||
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>ë<EFBFBD>أ<EFBFBD>');
|
||
if strtofloatdef(Trim(MJMaoZ.Text), 0) < 0.1 then
|
||
raise Exception.Create('ë<>ز<EFBFBD><D8B2><EFBFBD>С<EFBFBD><D0A1>0.1<EFBFBD><EFBFBD>');
|
||
if strtofloatdef(Trim(MJMaoZ.Text), 0) > 60 then
|
||
raise Exception.Create('ë<>ز<EFBFBD><D8B2>ܴ<EFBFBD><DCB4><EFBFBD>60<36><30>');
|
||
if strtofloatdef(trim(MJMaoZ.Text), 0) < 12 then
|
||
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>12!');
|
||
// if Trim(houdang.Text)='' then raise Exception.Create('<27><EFBFBD><F3B5B5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!');
|
||
// if ((trim(Edit12.Text) = '') and (trim(Edit7.Text) = '') and (trim(Edit1.Text) = '')) then
|
||
// raise Exception.Create('<27><>ѡ<EFBFBD><D1A1>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>');
|
||
|
||
Result := True;
|
||
except
|
||
Result := false;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
|
||
apid.SetFocus;
|
||
end;
|
||
end;
|
||
|
||
function TfrmMJManageNewFDJJAP.SelfConnData(): Boolean;
|
||
begin
|
||
try
|
||
with QryCheckNet do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
//<2F><>ѯһ<D1AF><D2BB>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
SQL.Add('select MainType from TbForBatch where 1=2');
|
||
Open;
|
||
end;
|
||
Result := true;
|
||
except
|
||
// if Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>磡','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
if not Assigned(DataLink_WeavingSchedule) then
|
||
DataLink_WeavingSchedule := TDataLink_WeavingSchedule.Create(Application);
|
||
try
|
||
with DataLink_WeavingSchedule.ADOLink do
|
||
begin
|
||
//if not Connected then
|
||
begin
|
||
Connected := false;
|
||
ConnectionString := DConString;
|
||
LoginPrompt := false;
|
||
Connected := true;
|
||
end;
|
||
end;
|
||
Result := true;
|
||
except
|
||
Result := false;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmMJManageNewFDJJAP := nil;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.On1201(var Message: Tmessage);
|
||
var
|
||
i1, i2: integer;
|
||
unitname: string;
|
||
fdata: double;
|
||
FMJKJZ, FMJMaoZ, FMJPiZ, FMJJingZ: Double;
|
||
begin
|
||
i1 := Message.WParam;
|
||
i2 := Message.LParam;
|
||
|
||
if TryStrToFloat(MJPiZ.Text, FMJPiZ) = False then
|
||
begin
|
||
FMJPiZ := 0;
|
||
end;
|
||
if TryStrToFloat(MJKJZ.Text, FMJKJZ) = False then
|
||
begin
|
||
FMJKJZ := 0;
|
||
end;
|
||
FMJMaoZ := RoundFloat(i1 / 100000, 1);
|
||
FMJJingZ := FMJMaoZ - FMJPiZ;
|
||
MJMaoZ.Text := floattostr(FMJMaoZ);
|
||
MJJingZ.Text := FloatToStr(FMJJingZ);
|
||
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.OpenCom(DllName: string);
|
||
type
|
||
TMyFunc = function(fhandle: hwnd; sCommName: PAnsiChar; IntTime: integer; IsMessage: integer): HWND; stdcall;
|
||
var
|
||
Tf: TMyFunc;
|
||
Tp: TFarProc;
|
||
Th: Thandle;
|
||
// newh:HWND; CDS_MJID
|
||
begin
|
||
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
|
||
FCK := 1;
|
||
showmessage('<27><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>ʧ<EFBFBD><CAA7>!');
|
||
Exit;
|
||
end
|
||
else
|
||
begin
|
||
FCK := 9;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
end;
|
||
finally
|
||
// FreeLibrary(Th);
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> ' + trim(DllName) + '<27><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>'), '<27><>ʾ');
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.CloseCom(DllName: string);
|
||
type
|
||
TMyFunc = function(sCommName: PAnsiChar): HWND; stdcall;
|
||
var
|
||
Tf1: TMyFunc;
|
||
Tp1: TFarProc;
|
||
Th1: Thandle;
|
||
//newh1:hwnd;
|
||
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 TfrmMJManageNewFDJJAP.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
if FCK = 9 then
|
||
begin
|
||
CloseCom(DZCDYDllName)
|
||
end;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.PrintData(FFFMJID: string);
|
||
var
|
||
fPrintFile: string;
|
||
i: Integer;
|
||
FDate: string;
|
||
Txt, fImagePath: string;
|
||
Moudle: THandle;
|
||
Makebar: TMakebar;
|
||
Mixtext: TMixtext;
|
||
begin
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩ.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
try
|
||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||
Txt := Trim(FFFMJID);
|
||
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
|
||
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
||
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
||
if FileExists(fImagePath) then
|
||
DeleteFile(fImagePath);
|
||
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('exec P_Print_PBLab :MJID');
|
||
Parameters.ParamByName('MJID').Value := Trim(FFFMJID);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryPrint, CDS_Print);
|
||
SInitCDSData20(ADOQueryPrint, CDS_Print);
|
||
RM2.LoadFromFile(fPrintFile);
|
||
RMVariables['QRBARCODE'] := fImagePath;
|
||
//RM2.ShowReport;
|
||
RM2.PrintReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩ.rmf'), '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.InitCDGrid();
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
if PState = 1 then
|
||
sql.Add('select * from WFB_MJJY_CD_PB where 1=2 ')
|
||
else
|
||
sql.Add('select * from WFB_MJJY_CD_PB where MJID=''' + Trim(CDS_MJID.fieldbyname('MJID').AsString) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, CDS_MJCD);
|
||
SInitCDSData20(ADOQueryMain, CDS_MJCD);
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.InitCDGridID();
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select JYPS=count(MJID) from WFB_MJJY_PB where Filler=''' + Trim(DName) + ''' ');
|
||
sql.Add(' and convert(varchar(10),DATEADD(MI,-450,FillTime) ,120)=convert(varchar(10),DATEADD(MI,-450,GETDATE()),120)');
|
||
Open;
|
||
end;
|
||
|
||
lblJYPS.Caption := '<27>ռ<EFBFBD><D5BC><EFBFBD>:' + trim(ADOQueryMain.fieldbyname('JYPS').AsString);
|
||
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select JYPS=count(MJID) from WFB_MJJY_PB where Filler=''' + Trim(DName) + ''' ');
|
||
sql.Add(' and convert(varchar(7),FillTime,120)=convert(varchar(7),GETDATE(),120)');
|
||
Open;
|
||
end;
|
||
|
||
lblJYPS.Caption := lblJYPS.Caption + ' <20>¼<EFBFBD><C2BC><EFBFBD>:' + trim(ADOQueryMain.fieldbyname('JYPS').AsString);
|
||
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select A.*,B.C_CODE from WFB_MJJY_PB A LEFT JOIN Cloth_Sub B ON A.SubId=B.SubId where A.MainId=''' + Trim(FMainId) + ''' ');
|
||
sql.Add(' and convert(varchar(10),A.FillTime,120)=convert(varchar(10),getdate(),120)');
|
||
sql.Add('and filler=''' + Trim(DName) + ''' ');
|
||
SQL.Add('order by A.filltime desc');
|
||
{if Trim(SCXFlag)<>'' then
|
||
sql.Add(' and JTType='''+Trim(SCXFlag)+''''); }
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, CDS_MJID);
|
||
SInitCDSData20(ADOQueryMain, CDS_MJID);
|
||
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.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 TfrmMJManageNewFDJJAP.Tv2CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
var
|
||
fsj: string;
|
||
begin
|
||
//FInt:=0;
|
||
//Tv1.DataController.FocusedRecordIndex;
|
||
//fsj:=Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.FormShow(Sender: TObject);
|
||
begin
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select FormPara1 from SY_ModuleSub where ModuleID=''10'' and ModuleSubID=''02'' ');
|
||
|
||
Open;
|
||
end;
|
||
Flogo := Trim(ADOTmp.FieldByName('FormPara1').AsString);
|
||
// Flogo := 'GY';
|
||
|
||
// Edit6.Text := '<27><>';
|
||
MJMaoZ.Font.Color := clRed;
|
||
|
||
Label57.caption := Trim(DName);
|
||
try
|
||
IniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'FileKPZ.INI');
|
||
DZCDYDllName := IniFile.ReadString('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD>ӳӵ<D3B3><D3B5><EFBFBD>Dll<6C>ļ<EFBFBD>', '');
|
||
MBDYDllName := IniFile.ReadString('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Dll<6C>ļ<EFBFBD>', '');
|
||
finally
|
||
IniFile.Free;
|
||
end;
|
||
LBRQ.DateTime := SGetServerDate(ADOTmp) - 1;
|
||
InitJP();
|
||
InitConNo();
|
||
InitSCPerson();
|
||
BTAdd.Click;
|
||
OpenCom(DZCDYDllName);
|
||
// if Trim(DCode)='ADMIN' then APID.ReadOnly:=False;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.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=''WFBCPBZZ'' 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 > 63 then
|
||
begin
|
||
i := 63;
|
||
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 TfrmMJManageNewFDJJAP.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 TfrmMJManageNewFDJJAP.AddCDNew(Fbtn: TSpeedButton);
|
||
begin
|
||
with CDS_MJCD do
|
||
begin
|
||
Append;
|
||
FieldByName('cdname').Value := Trim(TSpeedButton(Fbtn).Hint);
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.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 TfrmMJManageNewFDJJAP.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 TfrmMJManageNewFDJJAP.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 Trim(CDS_MJCD.fieldbyname('MCID').AsString) = '' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
CDS_MJCD.Delete;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.MJMaoZClick(Sender: TObject);
|
||
begin
|
||
FInt := 1;
|
||
FColumn := '';
|
||
panel3.Visible := True;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.MJLenClick(Sender: TObject);
|
||
begin
|
||
FInt := 2;
|
||
FColumn := '';
|
||
panel3.Visible := True;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.MJFKClick(Sender: TObject);
|
||
begin
|
||
FInt := 3;
|
||
FColumn := '';
|
||
panel3.Visible := True;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.MJBanZuClick(Sender: TObject);
|
||
begin
|
||
FInt := 4;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.MJSJKZClick(Sender: TObject);
|
||
begin
|
||
FInt := 4;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
//DataLink_WFBProducttion.ADOLink.Connected:=False;
|
||
FInt := 4;
|
||
// if PState=1 then Exit;
|
||
InitCDGridID();
|
||
//InitCDGrid();
|
||
{with ADOTmp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from WFB_MJJY where MJID='''+Trim(CDS_MJID.fieldbyname('MJID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
if ADOTmp.IsEmpty then
|
||
begin
|
||
MJMaoZ.Text:='';
|
||
MJLen.Text:='';
|
||
MJFK.Text:='';
|
||
MJSJKZ.Text:='';
|
||
end else
|
||
SSetWinData(ADOTmp,Panel5); }
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.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('MJID').AsString)='' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
PState:=0;
|
||
InitCDGrid();
|
||
with ADOTmp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from WFB_MJJY_PB where MJID='''+Trim(CDS_MJID.fieldbyname('MJID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
MJLen.Text:=Trim(ADOTmp.fieldbyname('MJLen').AsString);
|
||
MJMaoZ.Text:=Trim(ADOTmp.fieldbyname('MJMaoZ').AsString);
|
||
Label15.Caption:=Trim(CDS_MJID.fieldbyname('MJID').AsString);
|
||
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 TfrmMJManageNewFDJJAP.FormClick(Sender: TObject);
|
||
begin
|
||
FInt := 4;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.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 TfrmMJManageNewFDJJAP.SaveData(): Boolean;
|
||
var
|
||
maxno, JFMaxNo, FMJID, BZID, str1, maxsubno: string;
|
||
FMJLen, FYJQtyKg, KKMoney: Double;
|
||
FOrder: Integer;
|
||
begin
|
||
Result := False;
|
||
if PState < 1 then
|
||
Exit;
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from WFB_MJJY_PB where MJId=''' + Trim(FAPID) + '''');
|
||
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(FAPID);
|
||
FieldByName('MJStr2').Value := 'δ<><CEB4><EFBFBD><EFBFBD>';
|
||
FieldByName('MJStr4').Value := 'δ<><CEB4><EFBFBD><EFBFBD>';
|
||
FieldByName('MJBanZu').Value := Trim(FBanZu);
|
||
///////////////////////////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/////////////////////////////
|
||
|
||
|
||
if Trim(MJKJZ.Text) <> '' then
|
||
begin
|
||
if Trim(MJMaoZ.Text) <> '' then
|
||
begin
|
||
if Flogo = 'GY' then
|
||
FieldByName('MJMaoZ').Value := Ceil((StrToFloat(MJMaoZ.Text) + StrToFloat(MJKJZ.Text)) * 10) / 10
|
||
else
|
||
FieldByName('MJMaoZ').Value := StrToFloat(MJMaoZ.Text) + StrToFloat(MJKJZ.Text);
|
||
end;
|
||
if Trim(MJJingZ.Text) <> '' then
|
||
begin
|
||
if Flogo = 'GY' then
|
||
FieldByName('MJJingZ').Value := Ceil((StrToFloat(MJJingZ.Text) + StrToFloat(MJKJZ.Text)) * 10) / 10
|
||
else
|
||
FieldByName('MJJingZ').Value := StrToFloat(MJJingZ.Text) + StrToFloat(MJKJZ.Text);
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
if Trim(MJMaoZ.Text) <> '' then
|
||
begin
|
||
if Flogo = 'GY' then
|
||
FieldByName('MJMaoZ').Value := Ceil((StrToFloat(MJMaoZ.Text)) * 10) / 10
|
||
else
|
||
FieldByName('MJMaoZ').Value := StrToFloat(MJMaoZ.Text);
|
||
end;
|
||
if Trim(MJJingZ.Text) <> '' then
|
||
begin
|
||
if Flogo = 'GY' then
|
||
FieldByName('MJJingZ').Value := Ceil((StrToFloat(MJJingZ.Text)) * 10) / 10
|
||
else
|
||
FieldByName('MJJingZ').Value := StrToFloat(MJJingZ.Text);
|
||
end;
|
||
end;
|
||
///////////////////////////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/////////////////////////////
|
||
|
||
if Trim(MJPiZ.Text) <> '' then
|
||
begin
|
||
FieldByName('MJPiZ').Value := StrToFloat(MJPiZ.Text);
|
||
end;
|
||
|
||
if Trim(YJQtyKg.Text) <> '' then
|
||
begin
|
||
FieldByName('YJQtyKg').Value := StrToFloat(YJQtyKg.Text);
|
||
end;
|
||
if Trim(YJQtyM.Text) <> '' then
|
||
begin
|
||
FieldByName('YJQtyM').Value := StrToFloat(YJQtyM.Text);
|
||
end;
|
||
if Trim(Edit3.Text) <> '' then
|
||
begin
|
||
FieldByName('MJType').Value := '<27><>Ʒ';
|
||
end
|
||
else if Trim(Edit4.Text) <> '' then
|
||
begin
|
||
FieldByName('MJType').Value := '<27><>Ʒ'
|
||
end;
|
||
|
||
if Trim(Edit12.Text) <> '' then
|
||
begin
|
||
FieldByName('MJStr3').Value := '<27><>ɫ';
|
||
end;
|
||
if Trim(Edit7.Text) <> '' then
|
||
begin
|
||
FieldByName('MJStr3').Value := 'Ư<><C6AF>';
|
||
end;
|
||
if Trim(Edit1.Text) <> '' then
|
||
begin
|
||
FieldByName('MJStr3').Value := 'dzɫ';
|
||
end;
|
||
FieldByName('MJTypeOther').Value := Trim(Label9.Caption);
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('ClothType').Value := Trim(clothType.Text);
|
||
FieldByName('WorkShift').Value := Trim(WorkShift.Text);
|
||
FieldByName('JXPerson').Value := Trim(JXPerson.Text);
|
||
FieldByName('houdang').Value := Trim(houdang.Text);
|
||
FieldByName('LBRQ').Value := Trim(FormatDateTime('yyyy-MM-dd', LBRQ.DateTime));
|
||
FieldByName('LBXS').Value := Trim(LBXS.Text);
|
||
FieldByName('LBFZ').Value := Trim(LBFZ.Text);
|
||
|
||
FieldByName('SCPerson').Value := Trim(SCPerson.Text);
|
||
if Trim(JBSCPerson.Text) <> '' then
|
||
begin
|
||
FieldByName('JBSCPerson').Value := Trim(JBSCPerson.Text);
|
||
end;
|
||
|
||
if Trim(SCXFlag) <> '' then
|
||
begin
|
||
FieldByName('JTType').Value := Trim(SCXFlag);
|
||
end;
|
||
|
||
if Trim(JBZhuanQty.Text) <> '' then
|
||
begin
|
||
FieldByName('JBZhuanQty').Value := Trim(JBZhuanQty.Text);
|
||
end;
|
||
if Trim(JBSCPerson2.Text) <> '' then
|
||
begin
|
||
FieldByName('JBSCPerson2').Value := Trim(JBSCPerson2.Text);
|
||
end;
|
||
if Trim(JBZhuanQty2.Text) <> '' then
|
||
begin
|
||
FieldByName('JBZhuanQty2').Value := Trim(JBZhuanQty2.Text);
|
||
end;
|
||
if Trim(WzZhuanQty.Text) <> '' then
|
||
begin
|
||
FieldByName('WzZhuanQty').Value := Trim(WzZhuanQty.Text);
|
||
end;
|
||
|
||
Post;
|
||
end;
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('UPdate WFB_MJJY_PB Set MJXH=(select isnull(max(MJXH),0)+1 from WFB_MJJY_PB A where A.MainID=WFB_MJJY_PB.MainID)');
|
||
sql.Add(',FOrderNo=''' + Trim(ConNo.Text) + '''');
|
||
sql.Add(', SCPerson=''' + Trim(SCPerson.Text) + '''');
|
||
sql.Add(',CarNO=''' + Trim(CarNo.Text) + '''');
|
||
sql.Add(' where MJID=''' + Trim(FAPID) + '''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('update WFB_MJJY_PB set ZZPersonCode=X.Note from KH_Zdy X where X.Type=''SCPerson'' and X.ZDYName =WFB_MJJY_PB.SCPerson and WFB_MJJY_PB.MJID=''' + Trim(FAPID) + '''');
|
||
SQL.Add('update WFB_MJJY_PB set JBSCPersonCode=X.Note from KH_Zdy X where X.Type=''SCPerson'' and X.ZDYName =WFB_MJJY_PB.JBSCPerson and WFB_MJJY_PB.MJID=''' + Trim(FAPID) + '''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('Update JYCon_Sub_AnPai Set JYFlag=1 where APID=''' + Trim(FAPID) + '''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
///<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(ADOCmd, maxno, 'MC', 'WFB_MJJY_CD_PB', 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_PB ');
|
||
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(FAPID);
|
||
FieldByName('MCID').Value := Trim(maxno);
|
||
SSetSaveDataCDSNew(ADOCmd, Tv2, CDS_MJCD, 'WFB_MJJY_CD_PB', 0);
|
||
Post;
|
||
end;
|
||
CDS_MJCD.Edit;
|
||
CDS_MJCD.FieldByName('MCID').Value := Trim(maxno);
|
||
Next;
|
||
end;
|
||
end;
|
||
with CDS_MJID do
|
||
begin
|
||
Append;
|
||
FieldByName('MJID').Value := Trim(FAPID);
|
||
//FieldByName('MJType').Value:=
|
||
Post;
|
||
end;
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('UPdate WFB_MJJY_PB Set ');
|
||
sql.Add(' CDQK=dbo.F_Get_Order_SubStr_PB(WFB_MJJY_PB.MJID,''MJCDHZFM'') ');
|
||
sql.Add(' ,ZZPerson=dbo.F_Get_Order_SubStr_PB(WFB_MJJY_PB.MJID,''ZZPerson'') ');
|
||
sql.Add(',HZYJZP=(select sum(YJZP) from WFB_MJJY_CD_PB A where A.MJID=WFB_MJJY_PB.MJID)');
|
||
sql.Add(',CDGS=(select Count(*) from WFB_MJJY_CD_PB A where A.MJID=WFB_MJJY_PB.MJID)');
|
||
sql.Add(',CDHZQty=(select sum(CDQty) from WFB_MJJY_CD_PB A where A.MJID=WFB_MJJY_PB.MJID)');
|
||
sql.Add(',CDHZKgQty=(select sum(CDKgQty) from WFB_MJJY_CD_PB A where A.MJID=WFB_MJJY_PB.MJID)');
|
||
sql.Add(',CheJian=(select max(MCCJ) from Machine A where A.MCNO=WFB_MJJY_PB.CarNO)');
|
||
sql.Add(',APXH=(select XHInt from JYCon_Sub_AnPai A where A.APID=WFB_MJJY_PB.MJID)');
|
||
sql.Add(',APBatchNo=(select APBatchNo from JYCon_Sub_AnPai A where A.APID=WFB_MJJY_PB.MJID)');
|
||
sql.Add(',CKBatchNo=(select APBatchNo from JYCon_Sub_AnPai A where A.APID=WFB_MJJY_PB.MJID)');
|
||
sql.Add(' where MJID=''' + Trim(FAPID) + '''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update WFB_MJJY_PB Set ChuLiFlag=1 where MJID=''' + Trim(FAPID) + '''');
|
||
sql.Add(' and not exists(select MJID from WFB_MJJY_CD_PB A where A.MJID=WFB_MJJY_PB.MJID )');
|
||
ExecSQL;
|
||
end;
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Do_PBJYCRK @MJID=' + quotedstr(trim(Trim(FAPID))));
|
||
ExecSQL;
|
||
end;
|
||
|
||
ADOCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
PState := 0;
|
||
except
|
||
Result := False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.BTAddClick(Sender: TObject);
|
||
begin
|
||
if Trim(FMainId) = '' then
|
||
Exit;
|
||
PState := 1;
|
||
InitCDGridID();
|
||
InitCDGrid();
|
||
BtnStatus(True);
|
||
Label16.Caption := '<27><><EFBFBD><EFBFBD>';
|
||
//MJLen.Text:='';
|
||
// MJMaoZ.Text := '';
|
||
//ConNo.Text:='';
|
||
//SCPerson.Text:='';
|
||
//CarNo.Text:='';
|
||
// JBStr.Text := '';
|
||
// JBSCPerson.Text := '';
|
||
// JBZhuanQty.Text := '';
|
||
// JBZhuanQty2.Text := '';
|
||
// JBSCPerson2.Text := '';
|
||
//MJPiZ.Text:='';
|
||
// MJJingZ.Text := '';
|
||
// YJQtyKg.Text := '';
|
||
// YJQtyM.Text := '';
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.BTEditClick(Sender: TObject);
|
||
begin
|
||
if CDS_MJID.IsEmpty then
|
||
Exit;
|
||
PState := 2;
|
||
Label16.Caption := '<27><EFBFBD>';
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.BTPrintClick(Sender: TObject);
|
||
var
|
||
fPrintFile, FCarNo, FOrderNo, FJBZhuanQty, FJBZhuanQty2, FLBRQ, FLBXS, FLBFZ: string;
|
||
mvalue: Double;
|
||
FLBDate: TDateTime;
|
||
begin
|
||
|
||
if SelfConnData() = false then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD><C2B1><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if Trim(FMainId) = '' then
|
||
Exit;
|
||
if CheckData() = false then
|
||
exit;
|
||
|
||
if PState = 0 then
|
||
begin
|
||
if CDS_MJID.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룿<EFBFBD>볢<EFBFBD><EBB3A2><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
// if PState = 1 then
|
||
// begin
|
||
// if Application.MessageBox('<27>Ƿ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>棿<EFBFBD><E6A3BF><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD><EFBFBD><EFBFBD><F3BDABB2><EFBFBD><EFBFBD>ģ<DEB8>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
// Exit;
|
||
// end;
|
||
|
||
if SaveData() then
|
||
begin
|
||
if Trim(Edit6.Text) <> '' then
|
||
begin
|
||
PrintData(Trim(Label31.Caption));
|
||
end;
|
||
Label31.Caption := '';
|
||
ConNo.Text := '';
|
||
SCPerson.Text := '';
|
||
JBSCPerson.Text := '';
|
||
WzZhuanQty.Text := '';
|
||
// CarNo.Text := '';
|
||
LBPiKgQty.Caption := '';
|
||
Label55.Caption := '<27>ͻ<EFBFBD>';
|
||
LBXS.Text := '';
|
||
MJMaoZ.Text := '';
|
||
MJJingZ.Text := '';
|
||
LBFZ.Text := '';
|
||
YJQtyKg.Text := '';
|
||
YJQtyM.Text := '';
|
||
InitCDGridID();
|
||
|
||
APID.SetFocus;
|
||
end;
|
||
BTAdd.Click;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.BtnStatus(BSInt: Boolean);
|
||
begin
|
||
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.Tv2CDQtyPropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
try
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
if Trim(mvalue) <> '' then
|
||
begin
|
||
CDS_MJCD.Edit;
|
||
CDS_MJCD.FieldByName('CDQty').Value := mvalue;
|
||
CDS_MJCD.Post;
|
||
end
|
||
else
|
||
begin
|
||
CDS_MJCD.Edit;
|
||
CDS_MJCD.FieldByName('CDQty').Value := 0;
|
||
CDS_MJCD.Post;
|
||
end;
|
||
CDS_MJCD.Edit;
|
||
CDS_MJCD.FieldByName('CDQtyS').Value := mvalue;
|
||
except
|
||
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>֣<EFBFBD>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.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 TfrmMJManageNewFDJJAP.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 TfrmMJManageNewFDJJAP.SpeedButton13Click(Sender: TObject);
|
||
var
|
||
i: Integer;
|
||
begin
|
||
if Label31.Caption = '' then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ɨ<EFBFBD><C9A8>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Trim(CDS_MJCD.fieldbyname('MJID').AsString) <> '' then
|
||
begin
|
||
BTAdd.Click;
|
||
end;
|
||
if Trim(Label15.Caption) <> '' then
|
||
begin
|
||
//MJLen.Text:='';
|
||
MJMaoZ.Text := '';
|
||
Label15.Caption := '';
|
||
end;
|
||
if Trim(FMainId) = '' then
|
||
Exit;
|
||
FCDName := Trim(TSpeedButton(Sender).Hint);
|
||
MovePanel1.Visible := True;
|
||
Label21.Caption := Trim(FCDName);
|
||
FInt := 11;
|
||
// Edit1.SetFocus;
|
||
Panel3.Visible := True;
|
||
with Panel3 do
|
||
begin
|
||
for i := 0 to ControlCount - 1 do
|
||
begin
|
||
if Controls[i] is TSpeedButton then
|
||
begin
|
||
TSpeedButton(Controls[i]).Hint := Trim(CDGS.Name);
|
||
end;
|
||
end;
|
||
end;
|
||
CDGS.SetFocus;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.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 TfrmMJManageNewFDJJAP.Button1Click(Sender: TObject);
|
||
var
|
||
mvalue: Double;
|
||
begin
|
||
|
||
if CDQty.Text <> '' then
|
||
begin
|
||
if TryStrToFloat(CDQty.Text, mvalue) = False then
|
||
begin
|
||
Application.MessageBox('<27>õ㳤<C3B5>ȷǷ<C8B7><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
if CDGS.Text <> '' then
|
||
begin
|
||
if TryStrToFloat(CDGS.Text, mvalue) = False then
|
||
begin
|
||
Application.MessageBox('<27>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if mvalue = 0 then
|
||
begin
|
||
Application.MessageBox('<27>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪŶ0!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
// if CDGS.Text='' then
|
||
// begin
|
||
// if TryStrToFloat(CDGS.Text,mvalue)=False then
|
||
// begin
|
||
// Application.MessageBox('<27>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
// Exit;
|
||
// end;
|
||
// end;
|
||
if Trim(ZZPerson.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with CDS_MJCD do
|
||
begin
|
||
Append;
|
||
FieldByName('cdname').Value := Trim(FCDName);
|
||
if Trim(CDQty.Text) <> '' then
|
||
begin
|
||
FieldByName('CDQty').Value := StrToFloat(CDQty.Text);
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('CDQty').Value := 0;
|
||
end;
|
||
if Trim(CDGS.Text) <> '' then
|
||
begin
|
||
FieldByName('CDGS').Value := StrToFloat(CDGS.Text);
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('CDGS').Value := 0;
|
||
end;
|
||
if Trim(CDKgQty.Text) <> '' then
|
||
begin
|
||
FieldByName('CDKgQty').Value := StrToFloat(CDKgQty.Text);
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('CDKgQty').Value := 0;
|
||
end;
|
||
|
||
if Trim(YJZP.Text) <> '' then
|
||
begin
|
||
FieldByName('YJZP').Value := StrToFloat(YJZP.Text);
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('YJZP').Value := 0;
|
||
end;
|
||
|
||
FieldByName('ZZPerson').Value := Trim(ZZPerson.Text);
|
||
FieldByName('IsYj').Value := chkIsYj.Checked;
|
||
Post;
|
||
end;
|
||
CDQty.Text := '';
|
||
CDGS.Text := '';
|
||
CDKgQty.Text := '';
|
||
YJZP.Text := '';
|
||
chkIsYj.Checked := false;
|
||
MovePanel1.Visible := False;
|
||
Panel3.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.Button4Click(Sender: TObject);
|
||
begin
|
||
CDQty.Text := '';
|
||
CDGS.Text := '';
|
||
MovePanel1.Visible := False;
|
||
Panel3.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
InitJP();
|
||
InitConNo();
|
||
InitSCPerson();
|
||
BTAdd.Click;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.InitConNo();
|
||
begin
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.InitSCPerson();
|
||
var
|
||
fsj: string;
|
||
dt1: TDateTime;
|
||
begin
|
||
fsj := 'select Name=ZdyName from KH_Zdy where Type=''ClothType'' ';
|
||
SInitComBoxBySql(ADOTmp, ClothType, True, fsj);
|
||
ClothType.ItemIndex := 0;
|
||
|
||
fsj := 'select Name=ZdyName from KH_Zdy where Type=''WorkShift'' ';
|
||
SInitComBoxBySql(ADOTmp, WorkShift, True, fsj);
|
||
dt1 := Time();
|
||
// dt1 := StrToTime('02:00:00');
|
||
if (dt1 > StrToTime('07:30:00 ')) and (dt1 < StrToTime('19:30:00 ')) then
|
||
begin
|
||
WorkShift.ItemIndex := 0;
|
||
end
|
||
else
|
||
begin
|
||
WorkShift.ItemIndex := 1;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.SpeedButton49Click(Sender: TObject);
|
||
begin
|
||
Panel3.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.YJQtyKgClick(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 TfrmMJManageNewFDJJAP.Edit2Change(Sender: TObject);
|
||
var
|
||
mvalue: Double;
|
||
begin
|
||
{if Trim(Edit1.Text)<>'' then
|
||
begin
|
||
if TryStrToFloat(Edit1.Text,mvalue)=False then
|
||
begin
|
||
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
Exit;
|
||
end;
|
||
if Trim(Edit2.Text)<>'' then
|
||
begin
|
||
if TryStrToFloat(Edit2.Text,mvalue)=False then
|
||
begin
|
||
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
Exit;
|
||
end;
|
||
CDQty.Text:=FloatToStr(StrToFloat(Edit2.Text)-StrToFloat(Edit1.Text)); }
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.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 TfrmMJManageNewFDJJAP.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 TfrmMJManageNewFDJJAP.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 TfrmMJManageNewFDJJAP.Label9DblClick(Sender: TObject);
|
||
begin
|
||
{if Trim(Label9.Caption)='M' then
|
||
begin
|
||
Label9.Caption:='Y';
|
||
end else
|
||
begin
|
||
Label9.Caption:='M';
|
||
end; }
|
||
// Label19.Caption:=Trim(Label9.Caption);
|
||
//Label20.Caption:=Trim(Label9.Caption);
|
||
//Label7.Caption:=Trim(Label9.Caption);
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.CDQtyClick(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 TfrmMJManageNewFDJJAP.Edit10Click(Sender: TObject);
|
||
begin
|
||
{if Trim(Edit10.Text)='' then
|
||
begin
|
||
Edit10.Text:='<27><>';
|
||
Edit12.Text:='';
|
||
Edit7.Text:='';
|
||
end else
|
||
begin
|
||
Edit10.Text:='';
|
||
Edit12.Text:='';
|
||
Edit7.Text:='';
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.Edit12Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit12.Text) = '' then
|
||
begin
|
||
Edit1.Text := '';
|
||
Edit12.Text := '<27><>';
|
||
Edit7.Text := '';
|
||
end
|
||
else
|
||
begin
|
||
Edit1.Text := '';
|
||
Edit12.Text := '';
|
||
Edit7.Text := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.ConNoChange(Sender: TObject);
|
||
begin
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Cloth_Main where ConNo=''' + Trim(ConNo.Text) + '''');
|
||
Open;
|
||
end;
|
||
FMainId := Trim(ADOTmp.fieldbyname('MainId').AsString);
|
||
PState := 1;
|
||
InitCDGridID();
|
||
InitCDGrid();
|
||
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.JBStrClick(Sender: TObject);
|
||
begin
|
||
if Trim(JBStr.Text) = '' then
|
||
begin
|
||
JBStr.Text := '<27><>';
|
||
end
|
||
else
|
||
begin
|
||
JBStr.Text := '';
|
||
JBSCPerson.Text := '';
|
||
JBZhuanQty.Text := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.Edit7Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit7.Text) = '' then
|
||
begin
|
||
Edit1.Text := '';
|
||
Edit12.Text := '';
|
||
Edit7.Text := '<27><>';
|
||
end
|
||
else
|
||
begin
|
||
Edit1.Text := '';
|
||
Edit12.Text := '';
|
||
Edit7.Text := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.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 TfrmMJManageNewFDJJAP.InitDataJM();
|
||
begin
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from WFB_MJJY_PB');
|
||
sql.Add('where MJId=''' + Trim(APID.Text) + '''');
|
||
Open;
|
||
end;
|
||
if ADOTmp.IsEmpty = False then
|
||
begin
|
||
APID.Text := '';
|
||
Application.MessageBox('<27>˾<EFBFBD><CBBE>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
APID.SetFocus;
|
||
Exit;
|
||
end;
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select B.ConNo,B.KHName,B.GCCode,A.ChouZhen,A.c_codename,AA.APBatchNo');
|
||
sql.Add(',A.C_Qty,AA.APID,AA.SCPerson,AA.CarNo,AA.MainId,AA.SubId,A.PiZhong,A.PiKgQty,A.BatchNoHZ,AA.JXPerson,A.PiKgQtyFD ,AA.CHEJIAN');
|
||
sql.Add(',QQty=isnull(A.C_Qty,0)-isnull((select sum(MJMaoZ) from WFB_MJJY_PB PB where PB.SubId=A.SubId),0)');
|
||
sql.Add(' from JYCon_Sub_AnPai AA');
|
||
sql.Add(' inner join Cloth_Sub A on AA.SubId=A.SubId and AA.MainId=A.MainId ');
|
||
sql.Add(' inner join Cloth_Main B on AA.MainId=B.MainId ');
|
||
sql.Add('where AA.APId=''' + Trim(APID.Text) + '''');
|
||
Open;
|
||
end;
|
||
if ADOTmp.IsEmpty = False then
|
||
begin
|
||
Label55.Caption := Trim(ADOTmp.fieldbyname('KHName').AsString);
|
||
Label56.Caption := Trim(ADOTmp.fieldbyname('c_codename').AsString);
|
||
APBatchNo.Text := Trim(ADOTmp.fieldbyname('APBatchNo').AsString);
|
||
ConNo.Text := Trim(ADOTmp.fieldbyname('ConNo').AsString);
|
||
GCCode.Text := Trim(ADOTmp.fieldbyname('GCCode').AsString);
|
||
CarNo.Text := Trim(ADOTmp.fieldbyname('CarNo').AsString);
|
||
JXPerson.Text := Trim(ADOTmp.fieldbyname('JXPerson').AsString);
|
||
LabChouZhen.Caption := Trim(ADOTmp.fieldbyname('ChouZhen').AsString);
|
||
LabQty.Caption := Trim(ADOTmp.fieldbyname('C_Qty').AsString);
|
||
LabQQty.Caption := Trim(ADOTmp.fieldbyname('QQty').AsString);
|
||
// MJPiZ.Text:=Trim(ADOTmp.fieldbyname('PiZhong').AsString);
|
||
MJKJZ.Text := Trim(ADOTmp.fieldbyname('PiZhong').AsString);
|
||
lbl2.Caption := Trim(ADOTmp.fieldbyname('chejian').AsString);
|
||
FAPID := Trim(APID.Text);
|
||
FMainId := Trim(ADOTmp.fieldbyname('MainId').AsString);
|
||
FSubId := Trim(ADOTmp.fieldbyname('SubId').AsString);
|
||
Label31.Caption := FAPID;
|
||
if Trim(ADOTmp.fieldbyname('PiKgQtyFD').AsString) = '' then
|
||
begin
|
||
LBPiKgQty.Caption := Trim(ADOTmp.fieldbyname('PiKgQty').AsString);
|
||
end
|
||
else
|
||
begin
|
||
LBPiKgQty.Caption := Trim(ADOTmp.fieldbyname('PiKgQty').AsString) + '<27><>' + Trim(ADOTmp.fieldbyname('PiKgQtyFD').AsString);
|
||
end;
|
||
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select top 1 SCPerson from WFB_MJJY_PB');
|
||
sql.Add(' where CarNo=' + quotedstr(Trim(CarNo.Text)));
|
||
sql.Add(' and WorkShift=' + quotedstr(Trim(WorkShift.Text)));
|
||
sql.Add(' order by Filltime desc ');
|
||
Open;
|
||
end;
|
||
SCPerson.Text := Trim(ADOTmp.fieldbyname('SCPerson').AsString);
|
||
ZZPerson.Text := Trim(ADOTmp.fieldbyname('SCPerson').AsString);
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Label55.Caption := '<27>ͻ<EFBFBD>';
|
||
APID.Text := '';
|
||
FAPID := '';
|
||
FMainId := '';
|
||
FSubId := '';
|
||
Label31.Caption := '';
|
||
LBPiKgQty.Caption := '';
|
||
Exit;
|
||
end;
|
||
APID.Text := '';
|
||
BTAdd.Click;
|
||
// APID.SetFocus;
|
||
MJMaoZ.SetFocus;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.APIDKeyPress(Sender: TObject; var Key: Char);
|
||
var
|
||
fsj: string;
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
if BTPrint.Enabled = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޱ仯<DEB1><EFBFBD>!', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
InitDataJM();
|
||
fsj := 'select Name=ZdyName from KH_Zdy where Type=''ClothType'' ';
|
||
SInitComBoxBySql(ADOTmp, ClothType, True, fsj);
|
||
ClothType.ItemIndex := 0;
|
||
BTPrint.Click;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.Button2Click(Sender: TObject);
|
||
begin
|
||
if Trim(APID.Text) = '' then
|
||
Exit;
|
||
InitDataJM();
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.Edit13Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit13.Text) = '' then
|
||
begin
|
||
Edit13.Text := '<27><>';
|
||
OpenCom(DZCDYDllName);
|
||
end
|
||
else
|
||
begin
|
||
Edit13.Text := '';
|
||
if FCK = 9 then
|
||
CloseCom(DZCDYDllName)
|
||
else
|
||
begin
|
||
Exit;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.MJPiZChange(Sender: TObject);
|
||
var
|
||
FMJKJZ, FMJMaoZ, FMJPiZ, FMJJingZ: Double;
|
||
begin
|
||
// if TryStrToFloat(MJMaoZ.Text, FMJMaoZ) then
|
||
// begin
|
||
// if TryStrToFloat(MJPiZ.Text, FMJPiZ) = False then
|
||
// begin
|
||
// FMJPiZ := 0;
|
||
// end;
|
||
// FMJJingZ := FMJMaoZ - FMJPiZ;
|
||
// MJJingZ.Text := FloatToStr(FMJJingZ);
|
||
// end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.MJMaoZChange(Sender: TObject);
|
||
var
|
||
FMJKJZ, FMJMaoZ, FMJPiZ, FMJJingZ: Double;
|
||
begin
|
||
if TryStrToFloat(MJMaoZ.Text, FMJMaoZ) then
|
||
begin
|
||
if TryStrToFloat(MJPiZ.Text, FMJPiZ) = False then
|
||
begin
|
||
FMJPiZ := 0;
|
||
end;
|
||
if TryStrToFloat(MJKJZ.Text, FMJKJZ) = False then
|
||
begin
|
||
FMJKJZ := 0;
|
||
end;
|
||
FMJJingZ := FMJMaoZ - FMJPiZ;
|
||
MJJingZ.Text := FloatToStr(FMJJingZ);
|
||
end;
|
||
// Edit2.Text := '0';
|
||
// fjs := 0;
|
||
|
||
if strtofloatdef(trim(MJMaoZ.Text), 0) < 12 then
|
||
begin
|
||
BTPrint.Enabled := False;
|
||
Timer2.Enabled := False;
|
||
end
|
||
else
|
||
begin
|
||
BTPrint.Enabled := False;
|
||
Timer2.Enabled := True;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.Edit6Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit6.Text) = '' then
|
||
begin
|
||
Edit6.Text := '<27><>';
|
||
end
|
||
else
|
||
begin
|
||
Edit6.Text := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.Button3Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmSCPerson := TfrmSCPerson.Create(self);
|
||
with frmSCPerson do
|
||
begin
|
||
FlagStr := 'SCPerson';
|
||
FCHEJIAN := TRIM(LBL2.CAPTION);
|
||
if ShowModal = 1 then
|
||
begin
|
||
SCPerson.Text := frmSCPerson.FSDPerson;
|
||
ZZPerson.Text := frmSCPerson.FSDPerson;
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmSCPerson.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.Button5Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmSCPerson := TfrmSCPerson.Create(self);
|
||
with frmSCPerson do
|
||
begin
|
||
FlagStr := 'SCPerson';
|
||
FCHEJIAN := TRIM(LBL2.CAPTION);
|
||
if ShowModal = 1 then
|
||
begin
|
||
ZZPerson.Text := frmSCPerson.FSDPerson;
|
||
end;
|
||
end;
|
||
finally
|
||
frmSCPerson.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.Button6Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmSCPerson := TfrmSCPerson.Create(self);
|
||
|
||
with frmSCPerson do
|
||
begin
|
||
FlagStr := 'SCPerson';
|
||
FCHEJIAN := TRIM(LBL2.CAPTION);
|
||
if ShowModal = 1 then
|
||
begin
|
||
JBSCPerson.Text := frmSCPerson.FSDPerson;
|
||
end;
|
||
end;
|
||
finally
|
||
frmSCPerson.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.Button7Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmSCPerson := TfrmSCPerson.Create(self);
|
||
with frmSCPerson do
|
||
begin
|
||
FlagStr := 'SCPerson';
|
||
if ShowModal = 1 then
|
||
begin
|
||
JBSCPerson2.Text := frmSCPerson.FSDPerson;
|
||
end;
|
||
end;
|
||
finally
|
||
frmSCPerson.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.Button8Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmSCPerson := TfrmSCPerson.Create(self);
|
||
with frmSCPerson do
|
||
begin
|
||
FlagStr := 'houdang';
|
||
if ShowModal = 1 then
|
||
begin
|
||
houdang.Text := frmSCPerson.FSDPerson;
|
||
end;
|
||
end;
|
||
finally
|
||
frmSCPerson.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.MJKJZChange(Sender: TObject);
|
||
var
|
||
FMJKJZ, FMJMaoZ, FMJPiZ, FMJJingZ: Double;
|
||
begin
|
||
// if TryStrToFloat(MJMaoZ.Text,FMJMaoZ)=False then
|
||
// begin
|
||
// FMJMaoZ:=0;
|
||
// end;
|
||
// if TryStrToFloat(MJPiZ.Text,FMJPiZ)=False then
|
||
// begin
|
||
// FMJPiZ:=0;
|
||
// end;
|
||
// if TryStrToFloat(MJKJZ.Text,FMJKJZ)=False then
|
||
// begin
|
||
// FMJKJZ:=0;
|
||
// MJKJZ.Text:=FloatToStr(FMJPiZ);
|
||
// end;
|
||
// FMJJingZ:=FMJMaoZ-FMJPiZ-FMJKJZ;
|
||
// MJJingZ.Text:=FloatToStr(FMJJingZ);
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.Edit1Click(Sender: TObject);
|
||
begin
|
||
if Trim(Edit7.Text) = '' then
|
||
begin
|
||
Edit1.Text := '<27><>';
|
||
Edit12.Text := '';
|
||
Edit7.Text := '';
|
||
end
|
||
else
|
||
begin
|
||
Edit1.Text := '';
|
||
Edit12.Text := '';
|
||
Edit7.Text := '';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.ZZPersonKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select ZDYName from KH_ZDY where Type=''SCPerson'' and Note=''' + Trim(SCPerson.Text) + '''');
|
||
Open;
|
||
end;
|
||
ZZPerson.Text := trim(ADOTmp.FieldByName('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.MJMaoZKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
SCPerson.SetFocus;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.SCPersonKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
BTPrint.Click;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.edtSCAPIDKeyPress(Sender: TObject; var Key: Char);
|
||
var
|
||
SCAPID: string;
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
SCAPID := Trim(edtSCAPID.Text);
|
||
edtSCAPID.Text := '';
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϻ<EFBFBD><CFBA><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ָܻ<DCBB><D6B8><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
with ADOTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from CK_PBCP_CR where CRFlag=''<27><><EFBFBD><EFBFBD>'' and MJID=' + quotedstr(SCAPID));
|
||
Open;
|
||
end;
|
||
if ADOTmp.IsEmpty = False then
|
||
begin
|
||
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_PB_DelLog where MJID=' + quotedstr(SCAPID));
|
||
|
||
SQL.Add('insert into WFB_MJJY_PB_DelLog ');
|
||
sql.Add('select * from WFB_MJJY_PB where MJID=' + quotedstr(SCAPID));
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update WFB_MJJY_PB_DelLog Set Note=Isnull(Note,'''')+''<27><>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>:''+''' + Trim(DName) + '''');
|
||
sql.Add('+'' ''+Convert(Varchar(20),getdate(),120)');
|
||
sql.Add(' where MJID=' + quotedstr(SCAPID));
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete WFB_MJJY_PB where MJID=' + quotedstr(SCAPID));
|
||
sql.Add('delete WFB_MJJY_CD_PB where MJID=' + quotedstr(SCAPID));
|
||
sql.Add('delete CK_PBCP_CR where MJID=' + quotedstr(SCAPID));
|
||
sql.Add('delete CK_PBCP_kc where MJID=' + quotedstr(SCAPID));
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('Update JYCon_Sub_AnPai Set JYFlag=0 where APID=' + quotedstr(SCAPID));
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmMJManageNewFDJJAP.Timer2Timer(Sender: TObject);
|
||
begin
|
||
// edit2.Text := IntToStr(strtoint(edit2.text) + 1);
|
||
// if StrToInt(Edit2.Text) < 30 then
|
||
// begin
|
||
// BTPrint.Enabled := False;
|
||
// end
|
||
// else
|
||
// begin
|
||
// BTPrint.Enabled := True;
|
||
// end;
|
||
// fjs := fjs + 1;
|
||
// if fjs < 30 then
|
||
// begin
|
||
// BTPrint.Enabled := False;
|
||
// end
|
||
// else
|
||
// begin
|
||
BTPrint.Enabled := True;
|
||
// end;
|
||
end;
|
||
|
||
end.
|
||
|