253 lines
6.4 KiB
ObjectPascal
253 lines
6.4 KiB
ObjectPascal
![]() |
unit U_TJCKKC;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
|||
|
cxDataStorage, cxEdit, DB, cxDBData, cxCheckBox, cxDropDownEdit,
|
|||
|
cxGridCustomPopupMenu, cxGridPopupMenu, DBClient, ADODB, cxGridLevel,
|
|||
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
|||
|
cxControls, cxGridCustomView, cxGrid, ComCtrls, StdCtrls, BtnEdit,
|
|||
|
ExtCtrls, ToolWin, cxCalendar, cxButtonEdit, cxGridBandedTableView,
|
|||
|
cxGridDBBandedTableView, cxPC;
|
|||
|
|
|||
|
type
|
|||
|
TfrmTJCKKC = class(TForm)
|
|||
|
ToolBar2: TToolBar;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
ADOQuery1: TADOQuery;
|
|||
|
Order_Sub: TClientDataSet;
|
|||
|
DataSource1: TDataSource;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
Panel2: TPanel;
|
|||
|
ComboBox1: TComboBox;
|
|||
|
Label6: TLabel;
|
|||
|
Label8: TLabel;
|
|||
|
DRPS: TEdit;
|
|||
|
Label9: TLabel;
|
|||
|
DRQty: TEdit;
|
|||
|
cxGrid6: TcxGrid;
|
|||
|
Tv6: TcxGridDBTableView;
|
|||
|
v3Column3: TcxGridDBColumn;
|
|||
|
v3Column16: TcxGridDBColumn;
|
|||
|
v3Column7: TcxGridDBColumn;
|
|||
|
v3Column4: TcxGridDBColumn;
|
|||
|
v3Column5: TcxGridDBColumn;
|
|||
|
v3Column8: TcxGridDBColumn;
|
|||
|
v3Column9: TcxGridDBColumn;
|
|||
|
v3Column10: TcxGridDBColumn;
|
|||
|
v3Column11: TcxGridDBColumn;
|
|||
|
v3Column17: TcxGridDBColumn;
|
|||
|
v3Column1: TcxGridDBColumn;
|
|||
|
cxGridDBColumn2: TcxGridDBColumn;
|
|||
|
cxGridDBColumn3: TcxGridDBColumn;
|
|||
|
cxGridDBColumn7: TcxGridDBColumn;
|
|||
|
cxGridDBColumn11: TcxGridDBColumn;
|
|||
|
cxGridDBColumn14: TcxGridDBColumn;
|
|||
|
cxGridDBColumn12: TcxGridDBColumn;
|
|||
|
LiYongXS: TcxGridDBColumn;
|
|||
|
v3Column13: TcxGridDBColumn;
|
|||
|
v3Column18: TcxGridDBColumn;
|
|||
|
v3Column20: TcxGridDBColumn;
|
|||
|
v3Column2: TcxGridDBColumn;
|
|||
|
v3Column14: TcxGridDBColumn;
|
|||
|
v3Column15: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
Label3: TLabel;
|
|||
|
Label18: TLabel;
|
|||
|
Label19: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
Label1: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
Label5: TLabel;
|
|||
|
OrderNo: TEdit;
|
|||
|
BatchNo: TEdit;
|
|||
|
ConName: TEdit;
|
|||
|
PRTColor: TEdit;
|
|||
|
PRTHX: TEdit;
|
|||
|
FactoryName: TEdit;
|
|||
|
ToFactoryName: TEdit;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure OrderNoChange(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure v6Column2PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure Tv6MouseDown(Sender: TObject; Button: TMouseButton;
|
|||
|
Shift: TShiftState; X, Y: Integer);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
procedure InitGrid();
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
FFMainId:String;
|
|||
|
FDataType:string;
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmTJCKKC: TfrmTJCKKC;
|
|||
|
|
|||
|
implementation
|
|||
|
uses
|
|||
|
U_DataLink,U_RTFun;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmTJCKKC.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmTJCKKC:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTJCKKC.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action:=caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTJCKKC.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
ReadCxGrid('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>',Tv6,'<27><><EFBFBD>ڲֿ<DAB2>');
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
procedure TfrmTJCKKC.InitGrid();
|
|||
|
begin
|
|||
|
with ADOQuery1 do
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_View_DCLKC :ClotheType');
|
|||
|
Parameters.ParamByName('ClotheType').Value:=Trim(cxTabControl1.Tabs[cxTabControl1.TabIndex].Caption);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQuery1,Order_Sub);
|
|||
|
SInitCDSData20(ADOQuery1,Order_Sub);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTJCKKC.OrderNoChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQuery1.Active=False then Exit;
|
|||
|
SDofilter(ADOQuery1,SGetFilters(Panel1,1,2));
|
|||
|
SCreateCDS20(ADOQuery1,Order_Sub);
|
|||
|
SInitCDSData20(ADOQuery1,Order_Sub);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTJCKKC.ToolButton1Click(Sender: TObject);
|
|||
|
var
|
|||
|
FReal:Double;
|
|||
|
begin
|
|||
|
if Order_Sub.IsEmpty then Exit;
|
|||
|
{ if Order_Sub.Locate('SSel',True,[])=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end; }
|
|||
|
if Trim(Order_Sub.fieldbyname('ToFactoryName').AsString)='<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
ComboBox1.ItemIndex:=1;
|
|||
|
end;
|
|||
|
if Trim(ComboBox1.Text)='' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Trim(DRPS.Text)='' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Trim(DRQty.Text)='' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if TryStrToFloat(Trim(DRPS.Text),FReal)=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if TryStrToFloat(Trim(DRQty.Text),FReal)=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if StrToFloat(DRQty.Text)>Order_Sub.FieldByName('JSKCQty').Value then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4>ڿ<EFBFBD><DABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
{ if Order_Sub.FieldByName('OtherOrdFlag').AsBoolean=True then
|
|||
|
begin
|
|||
|
if Trim(FFMainId)=Trim(Order_Sub.fieldbyname('ORDMainId').AsString) then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>DZ<EFBFBD><C7B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end; }
|
|||
|
if Application.MessageBox(PChar('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><'+ComboBox1.Text+'<27>ֿ<EFBFBD>><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'),'<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
ModalResult:=1;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTJCKKC.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
WriteCxGrid('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>',Tv6,'<27><><EFBFBD>ڲֿ<DAB2>');
|
|||
|
ModalResult:=-1;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTJCKKC.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTJCKKC.v6Column2PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
Mvalue:Boolean;
|
|||
|
MDID:string;
|
|||
|
begin
|
|||
|
Mvalue:=TcxCheckBox(Sender).EditingValue;
|
|||
|
MDID:=Trim(Order_Sub.fieldbyname('MDID').AsString);
|
|||
|
with Order_Sub do
|
|||
|
begin
|
|||
|
while Order_Sub.Locate('SSel',True,[])=True do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value:=False;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
Order_Sub.Locate('MDID',MDID,[]);
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value:=Mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmTJCKKC.Tv6MouseDown(Sender: TObject; Button: TMouseButton;
|
|||
|
Shift: TShiftState; X, Y: Integer);
|
|||
|
begin
|
|||
|
if Trim(FDataType)='<27>ֿ<EFBFBD>' then
|
|||
|
begin
|
|||
|
ComboBox1.ItemIndex:=1;
|
|||
|
ComboBox1.Enabled:=false;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Trim(Order_Sub.fieldbyname('ToFactoryName').AsString)='<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
ComboBox1.ItemIndex:=1;
|
|||
|
ComboBox1.Enabled:=false;
|
|||
|
end else
|
|||
|
begin
|
|||
|
ComboBox1.ItemIndex:=-1;
|
|||
|
ComboBox1.Enabled:=True;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|