1622 lines
43 KiB
ObjectPascal
1622 lines
43 KiB
ObjectPascal
![]() |
unit U_MJManageNew;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, StdCtrls, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
|||
|
cxDataStorage, cxEdit, DB, cxDBData, cxCalendar, cxGridLevel,
|
|||
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
|||
|
cxControls, cxGridCustomView, cxGrid, RM_Common, RM_Class, RM_GridReport,
|
|||
|
RM_System, RM_Dataset, ADODB, DBClient, cxGridCustomPopupMenu,
|
|||
|
cxGridPopupMenu, ExtCtrls, ComCtrls, ToolWin, cxTextEdit, Buttons,
|
|||
|
cxSplitter, cxCheckBox, MovePanel;
|
|||
|
{function CommOpen(fhandle:hwnd;sCommName:PAnsiChar;
|
|||
|
IntTime:integer):integer;stdcall;external 'JCYData.DLL';
|
|||
|
function CommClose(sCommName:PAnsiChar):integer;stdcall;external 'JCYData.DLL';}
|
|||
|
|
|||
|
|
|||
|
type
|
|||
|
TfrmMJManageNew = class(TForm)
|
|||
|
Panel1: TPanel;
|
|||
|
MainId: TEdit;
|
|||
|
Label1: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
OrderNo: TEdit;
|
|||
|
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;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1OrderNo: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v1PRTMF: TcxGridDBColumn;
|
|||
|
v1PRTKZ: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
Tv2: TcxGridDBTableView;
|
|||
|
tv2CDType: TcxGridDBColumn;
|
|||
|
tv2CDWZ: TcxGridDBColumn;
|
|||
|
Tv2CDQty: TcxGridDBColumn;
|
|||
|
Tv2CDReason: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
TBCD: TToolButton;
|
|||
|
cxGrid3: TcxGrid;
|
|||
|
Tv3: TcxGridDBTableView;
|
|||
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
cxGridLevel2: TcxGridLevel;
|
|||
|
DataSource2: TDataSource;
|
|||
|
CDS_MJCD: TClientDataSet;
|
|||
|
DataSource3: TDataSource;
|
|||
|
CDS_MJID: TClientDataSet;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
Panel5: TPanel;
|
|||
|
Label3: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
Label5: TLabel;
|
|||
|
Label6: TLabel;
|
|||
|
Label7: TLabel;
|
|||
|
Label8: TLabel;
|
|||
|
Label9: TLabel;
|
|||
|
Label10: TLabel;
|
|||
|
Label11: TLabel;
|
|||
|
Label12: TLabel;
|
|||
|
Label13: TLabel;
|
|||
|
MJMaoZ: TEdit;
|
|||
|
MJLen: TEdit;
|
|||
|
MJFK: TEdit;
|
|||
|
MJBanZu: TEdit;
|
|||
|
BTPrint: TButton;
|
|||
|
Button38: TButton;
|
|||
|
MJSJKZ: TEdit;
|
|||
|
CDQty: TEdit;
|
|||
|
Timer1: TTimer;
|
|||
|
Label14: TLabel;
|
|||
|
BTAdd: TButton;
|
|||
|
BTEdit: TButton;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
Label15: TLabel;
|
|||
|
Label16: TLabel;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
v2Column2: TcxGridDBColumn;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
Button5: TButton;
|
|||
|
Panel3: TPanel;
|
|||
|
SpeedButton1: TSpeedButton;
|
|||
|
SpeedButton2: TSpeedButton;
|
|||
|
SpeedButton3: TSpeedButton;
|
|||
|
SpeedButton4: TSpeedButton;
|
|||
|
SpeedButton5: TSpeedButton;
|
|||
|
SpeedButton6: TSpeedButton;
|
|||
|
SpeedButton7: TSpeedButton;
|
|||
|
SpeedButton8: TSpeedButton;
|
|||
|
SpeedButton9: TSpeedButton;
|
|||
|
SpeedButton10: TSpeedButton;
|
|||
|
SpeedButton11: TSpeedButton;
|
|||
|
SpeedButton12: TSpeedButton;
|
|||
|
SpeedButton49: TSpeedButton;
|
|||
|
ScrollBox1: TScrollBox;
|
|||
|
SpeedButton13: TSpeedButton;
|
|||
|
SpeedButton14: TSpeedButton;
|
|||
|
SpeedButton15: TSpeedButton;
|
|||
|
SpeedButton16: TSpeedButton;
|
|||
|
SpeedButton17: TSpeedButton;
|
|||
|
SpeedButton18: TSpeedButton;
|
|||
|
SpeedButton19: TSpeedButton;
|
|||
|
SpeedButton20: TSpeedButton;
|
|||
|
SpeedButton21: TSpeedButton;
|
|||
|
SpeedButton22: TSpeedButton;
|
|||
|
SpeedButton23: TSpeedButton;
|
|||
|
SpeedButton24: TSpeedButton;
|
|||
|
SpeedButton25: TSpeedButton;
|
|||
|
SpeedButton26: TSpeedButton;
|
|||
|
SpeedButton27: TSpeedButton;
|
|||
|
SpeedButton28: TSpeedButton;
|
|||
|
SpeedButton29: TSpeedButton;
|
|||
|
SpeedButton30: TSpeedButton;
|
|||
|
SpeedButton31: TSpeedButton;
|
|||
|
SpeedButton32: TSpeedButton;
|
|||
|
SpeedButton33: TSpeedButton;
|
|||
|
SpeedButton34: TSpeedButton;
|
|||
|
SpeedButton35: TSpeedButton;
|
|||
|
SpeedButton36: TSpeedButton;
|
|||
|
SpeedButton37: TSpeedButton;
|
|||
|
SpeedButton38: TSpeedButton;
|
|||
|
SpeedButton39: TSpeedButton;
|
|||
|
SpeedButton40: TSpeedButton;
|
|||
|
SpeedButton41: TSpeedButton;
|
|||
|
SpeedButton42: TSpeedButton;
|
|||
|
Panel6: TPanel;
|
|||
|
Panel10: TPanel;
|
|||
|
Image2: TImage;
|
|||
|
Button2: TButton;
|
|||
|
Button3: TButton;
|
|||
|
cxGrid4: TcxGrid;
|
|||
|
TvSel: TcxGridDBTableView;
|
|||
|
cxGridDBColumn2: TcxGridDBColumn;
|
|||
|
vSelColumn1: TcxGridDBColumn;
|
|||
|
cxGridDBColumn5: TcxGridDBColumn;
|
|||
|
cxGridDBColumn6: TcxGridDBColumn;
|
|||
|
cxGridDBColumn7: TcxGridDBColumn;
|
|||
|
vSelColumn2: TcxGridDBColumn;
|
|||
|
cxGridLevel3: TcxGridLevel;
|
|||
|
MovePanel1: TMovePanel;
|
|||
|
Label17: TLabel;
|
|||
|
Label18: TLabel;
|
|||
|
Label19: TLabel;
|
|||
|
Label20: TLabel;
|
|||
|
Label21: TLabel;
|
|||
|
Edit1: TEdit;
|
|||
|
Button1: TButton;
|
|||
|
Button4: TButton;
|
|||
|
Edit2: TEdit;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
cxStyleRepository2: TcxStyleRepository;
|
|||
|
cxStyle3: TcxStyle;
|
|||
|
cxStyleRepository3: TcxStyleRepository;
|
|||
|
cxStyle4: TcxStyle;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
cxStyleRepository4: TcxStyleRepository;
|
|||
|
cxStyle5: TcxStyle;
|
|||
|
cxStyleRepository5: TcxStyleRepository;
|
|||
|
cxStyle6: TcxStyle;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
vSelColumn3: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
vSelColumn4: TcxGridDBColumn;
|
|||
|
vSelColumn5: TcxGridDBColumn;
|
|||
|
vSelColumn6: TcxGridDBColumn;
|
|||
|
vSelColumn7: TcxGridDBColumn;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure MainIdKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure Tv2CellClick(Sender: TcxCustomGridTableView;
|
|||
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure TBCDClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView;
|
|||
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure Button38Click(Sender: TObject);
|
|||
|
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 Timer1Timer(Sender: TObject);
|
|||
|
procedure MJMaoZChange(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 Panel10MouseMove(Sender: TObject; Shift: TShiftState; X,
|
|||
|
Y: Integer);
|
|||
|
procedure Image2Click(Sender: TObject);
|
|||
|
procedure Button3Click(Sender: TObject);
|
|||
|
procedure Button2Click(Sender: TObject);
|
|||
|
procedure TvSelCellClick(Sender: TcxCustomGridTableView;
|
|||
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure cxGridDBColumn2PropertiesChange(Sender: TObject);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure Button4Click(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure Edit1Click(Sender: TObject);
|
|||
|
procedure Edit2Click(Sender: TObject);
|
|||
|
procedure Button5Click(Sender: TObject);
|
|||
|
procedure SpeedButton49Click(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
FInt,PState,PrintInt,SCInitGrid:Integer;
|
|||
|
FColumn:String;
|
|||
|
MValue,FCDName:String;
|
|||
|
procedure InitJP();
|
|||
|
procedure InitGrid();
|
|||
|
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);
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmMJManageNew: TfrmMJManageNew;
|
|||
|
|
|||
|
implementation
|
|||
|
uses
|
|||
|
U_DataLink,U_Fun,U_ZDYHelp,U_iniParam;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmMJManageNew.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmMJManageNew:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.FormClose(Sender: TObject;
|
|||
|
var Action: TCloseAction);
|
|||
|
begin
|
|||
|
//DataLink_WFBProducttion.ADOLink.Connected:=False;
|
|||
|
Action:=caFree;
|
|||
|
end;
|
|||
|
procedure TfrmMJManageNew.MainIdKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key=#13 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
InitCDGridID();
|
|||
|
ADOQueryMain.First;
|
|||
|
SSetWinData(ADOQueryMain,Panel5);
|
|||
|
if CDS_MJID.IsEmpty then
|
|||
|
begin
|
|||
|
SClearData(Panel5,0);
|
|||
|
end;
|
|||
|
InitCDGrid();
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure TfrmMJManageNew.InitGrid();
|
|||
|
begin
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
//sql.Add('select A.OrderNo,B.* from WFBOrder_Main A inner join WFBOrder_Sub B on A.MainId=B.MainId where A.MainID='''+Trim(MainId.Text)+'''');
|
|||
|
{ sql.Add('select A.OrderNo,B.* from WFBOrder_Main A inner join WFBOrder_Sub B on A.MainId=B.MainId ');
|
|||
|
sql.Add(' inner join WFBOrder_Main_Attachment C on C.MainId=A.MainId');
|
|||
|
sql.Add(' where not exists(select * from WFBOrder_Status D where D.MainId=A.MainId and D.OSFlag10=1)'); }
|
|||
|
sql.Add(' exec P_ProductAnPai :begdate,:enddate,:pstate,:WSQl');
|
|||
|
Parameters.ParamByName('begdate').Value:='';
|
|||
|
Parameters.ParamByName('enddate').Value:='';
|
|||
|
Parameters.ParamByName('pstate').Value:=2;
|
|||
|
Parameters.ParamByName('WSQl').Value:='';
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,Order_MJ);
|
|||
|
SInitCDSData20(ADOQueryMain,Order_MJ);
|
|||
|
MainId.Text:='';
|
|||
|
end;
|
|||
|
procedure TfrmMJManageNew.InitCDGrid();
|
|||
|
begin
|
|||
|
with ADOQueryMain 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(ADOQueryMain,CDS_MJCD);
|
|||
|
SInitCDSData20(ADOQueryMain,CDS_MJCD);
|
|||
|
//MainId.Text:='';
|
|||
|
end;
|
|||
|
procedure TfrmMJManageNew.InitCDGridID();
|
|||
|
begin
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from WFB_MJJY where SubID='''+Trim(Order_MJ.fieldbyname('SubID').AsString)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,CDS_MJID);
|
|||
|
SInitCDSData20(ADOQueryMain,CDS_MJID);
|
|||
|
//MainId.Text:='';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.TBCloseClick(Sender: TObject);
|
|||
|
var
|
|||
|
maxno:string;
|
|||
|
begin
|
|||
|
WriteCxGrid('ĸ<><C4B8><EFBFBD><EFBFBD>Ϣ1',Tv1,'<27>IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
WriteCxGrid('ĸ<><C4B8><EFBFBD><EFBFBD>Ϣ2',TvSel,'<27>IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
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 TfrmMJManageNew.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 TfrmMJManageNew.TBCDClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag:='WFBCD';
|
|||
|
flagname:='<27>IJ<DEB7><C4B2>õ<EFBFBD>';
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
Self.InitJP();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
ReadCxGrid('ĸ<><C4B8><EFBFBD><EFBFBD>Ϣ1',Tv1,'<27>IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
ReadCxGrid('ĸ<><C4B8><EFBFBD><EFBFBD>Ϣ2',TvSel,'<27>IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
InitJP();
|
|||
|
InitGrid();
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from WFB_MJJY_CD_Temp where JTType='''+Trim(SCXFlag)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOTmp.IsEmpty=False then
|
|||
|
begin
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from WFB_MJJY_CD where MJID='''' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,CDS_MJCD);
|
|||
|
SInitCDSData20(ADOQueryMain,CDS_MJCD);
|
|||
|
PState:=1;
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
with CDS_MJCD do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('CDName').Value:=ADOTmp.fieldbyname('CDName').Value;
|
|||
|
FieldByName('CDBeg').Value:=ADOTmp.fieldbyname('CDBeg').Value;
|
|||
|
FieldByName('CDEnd').Value:=ADOTmp.fieldbyname('CDEnd').Value;
|
|||
|
FieldByName('CDQty').Value:=ADOTmp.fieldbyname('CDQty').Value;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from SY_User where UserId='''+Trim(DCode)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
MJBanZu.Text:=Trim(ADOTmp.fieldbyname('BanZu').AsString);
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete WFB_MJJY_CD_Temp where JTType='''+Trim(SCXFlag)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure TfrmMJManageNew.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>29 then
|
|||
|
begin
|
|||
|
i:=29;
|
|||
|
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 TfrmMJManageNew.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 TfrmMJManageNew.AddCDNew(Fbtn:TSpeedButton);
|
|||
|
begin
|
|||
|
with CDS_MJCD do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('cdname').Value:=Trim(TSpeedButton(Fbtn).Hint);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure TfrmMJManageNew.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 FInt=1 then
|
|||
|
begin
|
|||
|
MJMaoZ.Text:=Trim(MJMaoZ.Text)+Trim(TButton(Fbtn).Caption);
|
|||
|
end else
|
|||
|
if FInt=2 then
|
|||
|
begin
|
|||
|
MJLen.Text:=Trim(MJLen.Text)+Trim(TButton(Fbtn).Caption);
|
|||
|
end else
|
|||
|
if FInt=3 then
|
|||
|
begin
|
|||
|
MJFK.Text:=Trim(MJFK.Text)+Trim(TButton(Fbtn).Caption);
|
|||
|
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 TfrmMJManageNew.AddSLNew(Fbtn:TSpeedButton);
|
|||
|
begin
|
|||
|
if PState<1 then Exit;
|
|||
|
if Order_MJ.IsEmpty then Exit;
|
|||
|
|
|||
|
//if MJMaoZ.Focused then
|
|||
|
if FInt=4 then Exit;
|
|||
|
if FInt=1 then
|
|||
|
begin
|
|||
|
MJMaoZ.Text:=Trim(MJMaoZ.Text)+Trim(TSpeedButton(Fbtn).Caption);
|
|||
|
MJMaoZ.SelectAll;
|
|||
|
end else
|
|||
|
if FInt=2 then
|
|||
|
begin
|
|||
|
MJLen.Text:=Trim(MJLen.Text)+Trim(TSpeedButton(Fbtn).Caption);
|
|||
|
MJLen.SelectAll;
|
|||
|
end else
|
|||
|
if FInt=3 then
|
|||
|
begin
|
|||
|
MJFK.Text:=Trim(MJFK.Text)+Trim(TSpeedButton(Fbtn).Caption);
|
|||
|
MJFK.SelectAll;
|
|||
|
end else
|
|||
|
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 TfrmMJManageNew.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 CDS_MJCD.FieldByName('MJID').AsString='' then
|
|||
|
begin
|
|||
|
CDS_MJCD.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.Button38Click(Sender: TObject);
|
|||
|
begin
|
|||
|
FColumn:='';
|
|||
|
FInt:=0;
|
|||
|
try
|
|||
|
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag:='WFBBZ';
|
|||
|
flagname:='<27><><EFBFBD><EFBFBD>';
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
Self.MJBanZu.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.MJMaoZClick(Sender: TObject);
|
|||
|
begin
|
|||
|
FInt:=1;
|
|||
|
FColumn:='';
|
|||
|
panel3.Visible:=True;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.MJLenClick(Sender: TObject);
|
|||
|
begin
|
|||
|
FInt:=2;
|
|||
|
FColumn:='';
|
|||
|
panel3.Visible:=True;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.MJFKClick(Sender: TObject);
|
|||
|
begin
|
|||
|
FInt:=3;
|
|||
|
FColumn:='';
|
|||
|
panel3.Visible:=True;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.MJBanZuClick(Sender: TObject);
|
|||
|
begin
|
|||
|
FInt:=4;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.MJSJKZClick(Sender: TObject);
|
|||
|
begin
|
|||
|
FInt:=4;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.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 TfrmMJManageNew.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;
|
|||
|
|
|||
|
FInt:=4;
|
|||
|
PState:=0;
|
|||
|
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);
|
|||
|
BtnStatus(False);
|
|||
|
Label16.Caption:='';
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
procedure TfrmMJManageNew.FormClick(Sender: TObject);
|
|||
|
begin
|
|||
|
FInt:=4;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.Button12Click(Sender: TObject);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
if PState<1 then Exit;
|
|||
|
if Order_MJ.IsEmpty then Exit;
|
|||
|
//if MJMaoZ.Focused then
|
|||
|
if FInt=4 then Exit;
|
|||
|
if FInt=1 then
|
|||
|
begin
|
|||
|
if Trim(MJMaoZ.Text)<>'' then
|
|||
|
MJMaoZ.Text:=Copy(Trim(MJMaoZ.Text),1,Length(Trim(MJMaoZ.Text))-1);
|
|||
|
end else
|
|||
|
if FInt=2 then
|
|||
|
begin
|
|||
|
if Trim(MJLen.Text)<>'' then
|
|||
|
MJLen.Text:=Copy(Trim(MJLen.Text),1,Length(Trim(MJLen.Text))-1);
|
|||
|
end else
|
|||
|
if FInt=3 then
|
|||
|
begin
|
|||
|
if Trim(MJFK.Text)<>'' then
|
|||
|
MJFK.Text:=Copy(Trim(MJFK.Text),1,Length(Trim(MJFK.Text))-1);
|
|||
|
end else
|
|||
|
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;
|
|||
|
//MValue:=TcxTextEdit(Tv2CDQty).EditingText;
|
|||
|
//BTPrint.SetFocus;
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.Timer1Timer(Sender: TObject);
|
|||
|
begin
|
|||
|
CDQty.Text:=Tv2.DataController.Summary.FooterSummaryTexts[0];
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.MJMaoZChange(Sender: TObject);
|
|||
|
var
|
|||
|
KZSX,KZXX,FMJMaoZ,FMJLen,FMJFK:string;
|
|||
|
begin
|
|||
|
if PState=0 then Exit;
|
|||
|
if (Trim(MJMaoZ.Text)<>'') and (Trim(MJLen.Text)<>'') and (Trim(MJFK.Text)<>'') then
|
|||
|
begin
|
|||
|
MJSJKZ.Text:=FloatToStr(StrToFloat(MJMaoZ.Text)/(StrToFloat(MJLen.Text)*StrToFloat(MJFK.Text)/100)) ;
|
|||
|
MJSJKZ.Text:=FloatToStr(SSWR(StrToFloat(MJSJKZ.Text)*1000));
|
|||
|
//KZSX:=Trim(Order_MJ.fieldbyname('MJKZD').AsString);
|
|||
|
//KZXX:=Trim(Order_MJ.fieldbyname('MJKZX').AsString);
|
|||
|
KZSX:=Trim(Order_MJ.fieldbyname('KZBig').AsString);
|
|||
|
KZXX:=Trim(Order_MJ.fieldbyname('KZSmal').AsString);
|
|||
|
if (StrToFloat(MJSJKZ.Text)>=StrToFloat(KZXX)) and (StrToFloat(MJSJKZ.Text)<=StrToFloat(KZSX)) then
|
|||
|
begin
|
|||
|
Label14.Visible:=True;
|
|||
|
Label14.Caption:='ĸ<><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
Label14.Font.Color:=clBlue;
|
|||
|
end else
|
|||
|
if StrToFloat(MJSJKZ.Text)<StrToFloat(KZXX) then
|
|||
|
begin
|
|||
|
Label14.Visible:=True;
|
|||
|
Label14.Caption:='ĸ<><C4B8><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><D8B2><EFBFBD><'+floattostr(StrToFloat(KZXX)-StrToFloat(MJSJKZ.Text))+'g/<2F>O';
|
|||
|
Label14.Font.Color:=clRed;
|
|||
|
end else
|
|||
|
if StrToFloat(MJSJKZ.Text)>StrToFloat(KZSX) then
|
|||
|
begin
|
|||
|
Label14.Visible:=True;
|
|||
|
Label14.Caption:='ĸ<><C4B8><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><D8B3><EFBFBD>>'+floattostr(StrToFloat(MJSJKZ.Text)-StrToFloat(KZSX))+'g/<2F>O';
|
|||
|
Label14.Font.Color:=clRed;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
MJSJKZ.Text:='';
|
|||
|
Label14.Caption:='';
|
|||
|
Label14.Visible:=False;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmMJManageNew.SaveData():Boolean;
|
|||
|
var
|
|||
|
maxno,FMJID,BZID:String;
|
|||
|
FMJLen:Double;
|
|||
|
FOrder:Integer;
|
|||
|
begin
|
|||
|
if PState=1 then
|
|||
|
FMJID:=''
|
|||
|
else if PState=2 then
|
|||
|
FMJID:=Trim(CDS_MJID.fieldbyname('MJID').AsString)
|
|||
|
else 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 where MJId='''+Trim(FMJID)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
if Trim(FMJID)='' then
|
|||
|
begin
|
|||
|
Append;
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select Max(Cast(MJID as int)) as MJIDInt from WFB_JYResult');
|
|||
|
if Trim(SCXFlag)<>'' then
|
|||
|
begin
|
|||
|
sql.Add(' where JTType='''+Trim(SCXFlag)+'''');
|
|||
|
end;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
maxno:=Trim(ADOTmp.fieldbyname('MJIDInt').AsString);
|
|||
|
|
|||
|
{if GetLSNo(ADOTmp,maxno,Trim(SCXFlag),'WFB_MJJY',2,1)=False then
|
|||
|
begin
|
|||
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0);
|
|||
|
exit;
|
|||
|
end; }
|
|||
|
end
|
|||
|
else begin
|
|||
|
maxno:=Trim(FMJID);
|
|||
|
Edit;
|
|||
|
end;
|
|||
|
FieldByName('MainId').value:=Trim(Order_MJ.fieldbyname('MainId').AsString);
|
|||
|
FieldByName('SubId').value:=Trim(Order_MJ.fieldbyname('SubId').AsString);
|
|||
|
FieldByName('MJID').Value:=Trim(maxno);
|
|||
|
FieldByName('MJMaoZ').Value:=Trim(MJMaoZ.Text);
|
|||
|
FieldByName('MJLen').Value:=Trim(MJLen.Text);
|
|||
|
FieldByName('MJFK').Value:=Trim(MJFK.Text);
|
|||
|
FieldByName('MJSJKZ').Value:=Trim(MJSJKZ.Text);
|
|||
|
FieldByName('MJBanZu').Value:=Trim(MJBanZu.Text);
|
|||
|
if Trim(FMJID)='' then
|
|||
|
begin
|
|||
|
FieldByName('Filler').Value:=Trim(DName);
|
|||
|
end else
|
|||
|
begin
|
|||
|
FieldByName('Editer').Value:=Trim(DName);
|
|||
|
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTmp);
|
|||
|
end;
|
|||
|
if Trim(SCXFlag)<>'' then
|
|||
|
begin
|
|||
|
FieldByName('JTType').Value:=Trim(SCXFlag);
|
|||
|
end;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
FMJID:=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',3,1)=False then
|
|||
|
begin
|
|||
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
maxno:=Trim(CDS_MJCD.fieldbyname('MCID').AsString);
|
|||
|
end;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from WFB_MJJY_CD ');
|
|||
|
sql.Add(' where MCID='''+Trim(maxno)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
if Trim(CDS_MJCD.fieldbyname('MCID').AsString)='' then
|
|||
|
Append
|
|||
|
else
|
|||
|
Edit;
|
|||
|
FieldByName('MJId').Value:=Trim(FMJID);
|
|||
|
FieldByName('MCID').Value:=Trim(maxno);
|
|||
|
SSetSaveDataCDSNew(ADOCmd,Tv2,CDS_MJCD,'WFB_MJJY_CD',0);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
CDS_MJCD.Edit;
|
|||
|
CDS_MJCD.FieldByName('MCID').Value:=Trim(maxno);
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select Top 1* from WFB_BanZu where MJID='''+Trim(FMJID)+'''');
|
|||
|
sql.Add(' and BanZu='''+Trim(MJBanZu.Text)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOTmp.IsEmpty then
|
|||
|
begin
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select Top 1* from WFB_BanZu where MJID='''+Trim(FMJID)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOTmp.IsEmpty then
|
|||
|
begin
|
|||
|
FMJLen:=0;
|
|||
|
end else
|
|||
|
begin
|
|||
|
FMJLen:=ADOTmp.fieldbyname('MJLen').Value;
|
|||
|
end;
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from SY_User where BanZu='''+Trim(MJBanZu.Text)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if GetLSNo(ADOCmd,BZID,'BZ','WFB_BanZu',4,1)=False then
|
|||
|
begin
|
|||
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from WFB_BanZu where 1<>1');
|
|||
|
open;
|
|||
|
end;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('BZID').Value:=Trim(BZID);
|
|||
|
FieldByName('BanZu').Value:=Trim(MJBanZu.Text);
|
|||
|
FieldByName('MJID').Value:=Trim(FMJID);
|
|||
|
FieldByName('MJLen').Value:=StrToFloat(MJLen.Text)-FMJlen;
|
|||
|
FieldByName('UserId').Value:=Trim(ADOTmp.fieldbyname('UserId').AsString);
|
|||
|
FieldByName('UserName').Value:=Trim(ADOTmp.fieldbyname('UserName').AsString);
|
|||
|
FieldByName('Filler').Value:=Trim(DName);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>
|
|||
|
with Order_MJ do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('SCMQty').Value:=FieldByName('SCMQty').Value+Strtofloat(MJLen.Text);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with Order_MJ do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('WSCMQty').Value:=FieldByName('OrderQtyM').Value-FieldByName('SCMQty').Value;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
if ((Order_MJ.FieldByName('SCMQty').Value-Order_MJ.FieldByName('OrderQtyM').Value)/Order_MJ.FieldByName('OrderQtyM').Value )>=0 then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update WFBOrder_Sub Set SCStatus=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',SCOrder='''' ');
|
|||
|
SQL.Add(' where SubId='''+Trim(Order_MJ.fieldbyname('SubId').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('exec P_ProductAnPai_JY');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOTmp.IsEmpty=False then
|
|||
|
begin
|
|||
|
FOrder:=1;
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update WFBOrder_Sub Set SCOrder='''+Trim(IntToStr(FOrder))+'''');
|
|||
|
SQL.Add(' where SubId='''+Trim(ADOTmp.FieldByName('SubId').Asstring)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
FOrder:=FOrder+1;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
SCInitGrid:=1;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update WFBOrder_Sub Set SCStatus=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
SQL.Add(' where SubId='''+Trim(Order_MJ.fieldbyname('SubId').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOCmd.Connection.CommitTrans;
|
|||
|
Result:=True;
|
|||
|
InitCDGridID();
|
|||
|
CDS_MJID.Locate('MJID',FMJID,[]);
|
|||
|
PState:=0;
|
|||
|
except
|
|||
|
Result:=False;
|
|||
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.BTAddClick(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
if PState=1 then
|
|||
|
begin
|
|||
|
if( (CDS_MJCD.IsEmpty=False) or (Trim(MJMaoZ.Text)<>'') or (Trim(MJLen.Text)<>'') or (Trim(MJFK.Text)<>'') ) then
|
|||
|
if Application.MessageBox(PChar(' <20><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>ӡ<EFBFBD><D3A1><EFBFBD>Ƿ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>?'+#13+#13+'<27><><EFBFBD><EFBFBD>"<22><>(Y)"<22><><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD>ᶪʧ<E1B6AA><CAA7>'),'<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
end;
|
|||
|
if Order_MJ.IsEmpty then Exit;
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select BanZu from SY_User where UserId='''+Trim(DCode)+'''');
|
|||
|
Open;
|
|||
|
MJBanZu.Text:=Trim(Fieldbyname('BanZu').AsString);
|
|||
|
end;
|
|||
|
if Trim(MJBanZu.Text)='' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ð<EFBFBD><C3B0>飡','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
PState:=1;
|
|||
|
InitCDGrid();
|
|||
|
SClearData(Panel5,0);
|
|||
|
{Tv2.OptionsSelection.CellSelect:=True;
|
|||
|
MJMaoZ.ReadOnly:=False;
|
|||
|
MJLen.ReadOnly:=False;
|
|||
|
MJFK.ReadOnly:=False;
|
|||
|
Button38.Enabled:=True; }
|
|||
|
BtnStatus(True);
|
|||
|
|
|||
|
Label16.Caption:='<27><><EFBFBD><EFBFBD>';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.BTEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_MJID.IsEmpty then Exit;
|
|||
|
PState:=2;
|
|||
|
Label16.Caption:='<27><EFBFBD>';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.BTPrintClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile,FFMJFK,FFYDFK:string;
|
|||
|
begin
|
|||
|
if Order_MJ.IsEmpty then Exit;
|
|||
|
if FInt=4 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 Trim(MJMaoZ.Text)='' then
|
|||
|
begin
|
|||
|
Application.MessageBox('ë<>ز<EFBFBD><D8B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Trim(MJLen.Text)='' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Trim(MJFK.Text)='' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
FFMJFK:=Trim(MJFK.Text);
|
|||
|
FFYDFK:=Trim(Order_MJ.fieldbyname('BigMF').AsString);
|
|||
|
if ((StrToFloat(FFMJFK)-StrToFloat(FFYDFK))/StrToFloat(FFYDFK))<-0.3 then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if ((StrToFloat(FFMJFK)-StrToFloat(FFYDFK))/StrToFloat(FFYDFK))>0.3 then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Trim(MJBanZu.Text)='' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD>鲻<EFBFBD><E9B2BB>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
Panel6.Visible:=True;
|
|||
|
{ if PState=1 then
|
|||
|
begin
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD>𣿴<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<DEB8>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
end;
|
|||
|
if SaveData() then
|
|||
|
begin
|
|||
|
BtnStatus(False);
|
|||
|
end;
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select RTrim(A.MJID) MJID,RTrim(A.MJSJKZ) MJSJKZ,RTrim(A.MJFK) MJFK,RTrim(B.OrderNo) OrderNo,RTrim(B.WFBCodeName) WFBCodeName from WFB_MJJY A inner join WFBOrder_Main B on A.MainId=B.MainId');
|
|||
|
sql.Add(' where A.MJID='''+Trim(CDS_MJID.fieldbyname('MJID').AsString)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
fPrintFile:=ExtractFilePath(Application.ExeName)+'Report\ĸ<><C4B8><EFBFBD><EFBFBD>ǩ.rmf' ;
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
RM2.ShowReport;
|
|||
|
end else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\ĸ<><C4B8><EFBFBD><EFBFBD>ǩ.rmf'),'<27><>ʾ',0);
|
|||
|
end;
|
|||
|
Label16.Caption:='';
|
|||
|
BTAdd.Click; }
|
|||
|
end;
|
|||
|
procedure TfrmMJManageNew.BtnStatus(BSInt:Boolean);
|
|||
|
begin
|
|||
|
Tv2.OptionsSelection.CellSelect:=BSInt;
|
|||
|
MJMaoZ.ReadOnly:=not BSInt;
|
|||
|
MJLen.ReadOnly:=not BSInt;
|
|||
|
MJFK.ReadOnly:=not BSInt;
|
|||
|
Button38.Enabled:=BSInt;
|
|||
|
end;
|
|||
|
procedure TfrmMJManageNew.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 TfrmMJManageNew.SpeedButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
AddSLNew(TSpeedButton(Sender));
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.SpeedButton12Click(Sender: TObject);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
if PState<1 then Exit;
|
|||
|
if Order_MJ.IsEmpty then Exit;
|
|||
|
//if MJMaoZ.Focused then
|
|||
|
if FInt=4 then Exit;
|
|||
|
if FInt=1 then
|
|||
|
begin
|
|||
|
if Trim(MJMaoZ.Text)<>'' then
|
|||
|
begin
|
|||
|
MJMaoZ.Text:=Copy(Trim(MJMaoZ.Text),1,Length(Trim(MJMaoZ.Text))-1);
|
|||
|
MJMaoZ.SelectAll;
|
|||
|
end;
|
|||
|
end else
|
|||
|
if FInt=2 then
|
|||
|
begin
|
|||
|
if Trim(MJLen.Text)<>'' then
|
|||
|
begin
|
|||
|
MJLen.Text:=Copy(Trim(MJLen.Text),1,Length(Trim(MJLen.Text))-1);
|
|||
|
MJLen.SelectAll;
|
|||
|
end;
|
|||
|
end else
|
|||
|
if FInt=3 then
|
|||
|
begin
|
|||
|
if Trim(MJFK.Text)<>'' then
|
|||
|
begin
|
|||
|
MJFK.Text:=Copy(Trim(MJFK.Text),1,Length(Trim(MJFK.Text))-1);
|
|||
|
MJFK.SelectAll;
|
|||
|
end;
|
|||
|
end else
|
|||
|
if FInt=11 then
|
|||
|
begin
|
|||
|
if Trim(Edit1.Text)<>'' then
|
|||
|
begin
|
|||
|
Edit1.Text:=Copy(Trim(Edit1.Text),1,Length(Trim(Edit1.Text))-1);
|
|||
|
Edit1.SelectAll;
|
|||
|
end;
|
|||
|
end else
|
|||
|
if FInt=12 then
|
|||
|
begin
|
|||
|
if Trim(Edit2.Text)<>'' then
|
|||
|
begin
|
|||
|
Edit2.Text:=Copy(Trim(Edit2.Text),1,Length(Trim(Edit2.Text))-1);
|
|||
|
Edit2.SelectAll;
|
|||
|
end;
|
|||
|
end;{ else
|
|||
|
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;
|
|||
|
//Tv2.GetColumnByFieldName(FColumn).Selected:=True;
|
|||
|
// Tv2.GetColumnByFieldName(FColumn).FocusWithSelection;
|
|||
|
//(Tv2.GetColumnByFieldName(FColumn).Properties as TcxTextEditProperties).AutoSelect:=True;
|
|||
|
end;
|
|||
|
//MValue:=TcxTextEdit(Tv2CDQty).EditingText;
|
|||
|
//BTPrint.SetFocus;
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
end;
|
|||
|
end;}
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.SpeedButton13Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if PState<1 then Exit;
|
|||
|
if Order_MJ.IsEmpty then Exit;
|
|||
|
FCDName:=Trim(TSpeedButton(Sender).Hint);
|
|||
|
MovePanel1.Visible:=True;
|
|||
|
Label21.Caption:=Trim(FCDName);
|
|||
|
FInt:=11;
|
|||
|
Edit1.SetFocus;
|
|||
|
Panel3.Visible:=True;
|
|||
|
//AddCDNew(TSpeedButton(Sender));
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.Panel10MouseMove(Sender: TObject;
|
|||
|
Shift: TShiftState; X, Y: Integer);
|
|||
|
begin
|
|||
|
ReleaseCapture;
|
|||
|
TWinControl(Panel6).perform(WM_SYSCOMMAND, $F012, 0);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.Image2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel6.Visible:=False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.Button3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel6.Visible:=False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.Button2Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile:String;
|
|||
|
begin
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from WFB_JYResult where Cast(MJID as int)>');
|
|||
|
sql.Add(' (select isnull(Max(Cast(MJID as int)),0) from WFB_MJJY ');
|
|||
|
if Trim(SCXFlag)<>'' then
|
|||
|
begin
|
|||
|
sql.Add(' where JTType='''+Trim(SCXFlag)+'''');
|
|||
|
end;
|
|||
|
sql.Add(')');
|
|||
|
if Trim(SCXFlag)<>'' then
|
|||
|
begin
|
|||
|
sql.Add(' and JTType='''+Trim(SCXFlag)+'''');
|
|||
|
end;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOTmp.IsEmpty then
|
|||
|
begin
|
|||
|
Application.MessageBox('δ<><CEB4><EFBFBD>鲻<EFBFBD>ܴ<EFBFBD>ӡ<EFBFBD><D3A1>ǩ<EFBFBD><C7A9>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Order_MJ.Locate('SSel',True,[])=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('δѡ<CEB4><D1A1><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if PState=1 then
|
|||
|
begin
|
|||
|
if Application.MessageBox('<27>Ƿ<EFBFBD>Ҫ<EFBFBD><D2AA>ӡ<EFBFBD><D3A1><EFBFBD>룿<EFBFBD><EBA3BF>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<DEB8>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
Panel6.Visible:=False;
|
|||
|
end;
|
|||
|
|
|||
|
if SaveData() then
|
|||
|
begin
|
|||
|
BtnStatus(False);
|
|||
|
end;
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select RTrim(A.MJID) MJID,RTrim(Cast(A.MJSJKZ As varchar(20))) MJSJKZ,RTrim(Cast(A.MJFK as varchar(20))) MJFK,RTrim(B.OrderNo) OrderNo,');
|
|||
|
sql.Add(' RTrim(Cast(A.MJMaoZ As varchar(20))) MJMaoZ,RTrim(Cast(A.MJLen As varchar(20))) MJLen,');
|
|||
|
sql.Add(' Rtrim(C.SWFBColor) SWFBColor,Rtrim(Cast(C.SWFBKZ as varchar(20))) SWFBKZ, YLPB=dbo.F_Get_WFBOrder_SubStr(C.SubId,''YLPBSZ'')');
|
|||
|
sql.Add(',RTrim(C.SWFBCodeName) SWFBCodeName from WFB_MJJY A inner join WFBOrder_Main B on A.MainId=B.MainId');
|
|||
|
sql.Add(' inner join WFBOrder_Sub C on A.SubId=C.SubId');
|
|||
|
sql.Add(' where A.MJID='''+Trim(CDS_MJID.fieldbyname('MJID').AsString)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if SCInitGrid=1 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
SCInitGrid:=0;
|
|||
|
end;
|
|||
|
fPrintFile:=ExtractFilePath(Application.ExeName)+'Report\ĸ<><C4B8><EFBFBD><EFBFBD>ǩ.rmf' ;
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
//RM2.ShowReport;
|
|||
|
RM2.PrintReport;
|
|||
|
end else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\ĸ<><C4B8><EFBFBD><EFBFBD>ǩ.rmf'),'<27><>ʾ',0);
|
|||
|
end;
|
|||
|
Label16.Caption:='';
|
|||
|
BTAdd.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.TvSelCellClick(Sender: TcxCustomGridTableView;
|
|||
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
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 TfrmMJManageNew.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 TfrmMJManageNew.Button1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
//MovePanel1.Visible:=True;
|
|||
|
if Trim(Edit1.Text)='' then
|
|||
|
begin
|
|||
|
Application.MessageBox('λ<>ò<EFBFBD><C3B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
with CDS_MJCD do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('cdname').Value:=Trim(FCDName);
|
|||
|
FieldByName('CDbeg').Value:=Trim(Edit1.Text);
|
|||
|
FieldByName('CDEnd').Value:=Trim(Edit2.Text);
|
|||
|
if Trim(Edit2.Text)<>'' then
|
|||
|
begin
|
|||
|
FieldByName('CDQty').Value:=StrToFloat(Edit2.Text)-StrToFloat(Edit1.Text);
|
|||
|
end else
|
|||
|
begin
|
|||
|
FieldByName('CDQty').Value:=0;
|
|||
|
end;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
Edit1.Text:='';
|
|||
|
Edit2.Text:='';
|
|||
|
MovePanel1.Visible:=False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.Button4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
MovePanel1.Visible:=False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
InitJP();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.Edit1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
FInt:=11;
|
|||
|
panel3.Visible:=True;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.Edit2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
FInt:=12;
|
|||
|
panel3.Visible:=True;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.Button5Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile:String;
|
|||
|
begin
|
|||
|
if CDS_MJID.IsEmpty then Exit;
|
|||
|
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update WFB_MJJY Set PrtAgnFlag=1,PrtAgnDate=getdate(),PrtAgnPerson='''+Trim(DName)+'''');
|
|||
|
sql.Add(' where MJID='''+Trim(CDS_MJID.fieldbyname('MJID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select RTrim(A.MJID) MJID,RTrim(A.MJSJKZ) MJSJKZ,RTrim(A.MJFK) MJFK,RTrim(B.OrderNo)+'' <20>ش<EFBFBD>'' OrderNo,');
|
|||
|
sql.Add('RTrim(A.MJLen) MJLen,RTrim(A.MJMaoZ) MJMaoZ,');
|
|||
|
sql.Add('Rtrim(C.SWFBColor) SWFBColor,Rtrim(C.SWFBKZ) SWFBKZ, YLPB=dbo.F_Get_WFBOrder_SubStr(C.SubId,''YLPBSZ'')');
|
|||
|
sql.Add(',RTrim(C.SWFBCodeName) SWFBCodeName from WFB_MJJY A inner join WFBOrder_Main B on A.MainId=B.MainId');
|
|||
|
sql.Add(' inner join WFBOrder_Sub C on A.SubId=C.SubId');
|
|||
|
sql.Add(' where A.MJID='''+Trim(CDS_MJID.fieldbyname('MJID').AsString)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
fPrintFile:=ExtractFilePath(Application.ExeName)+'Report\ĸ<><C4B8><EFBFBD><EFBFBD>ǩ.rmf' ;
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
//RM2.ShowReport;
|
|||
|
RM2.PrintReport;
|
|||
|
end else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\ĸ<><C4B8><EFBFBD><EFBFBD>ǩ.rmf'),'<27><>ʾ',0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmMJManageNew.SpeedButton49Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel3.Visible:=False;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|