940 lines
26 KiB
ObjectPascal
940 lines
26 KiB
ObjectPascal
unit U_DyePlanList;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
||
cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView,
|
||
cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, cxMemo,
|
||
cxRichEdit, ComCtrls, cxContainer, cxTextEdit, cxMaskEdit, cxButtonEdit,
|
||
StdCtrls, ToolWin, DBClient, ADODB, ExtCtrls, BtnEdit, cxCalendar, StrUtils,
|
||
cxCurrencyEdit, cxImage, cxDBEdit, Menus, RM_Common, RM_Class, RM_e_Xls,
|
||
RM_Dataset, RM_System, RM_GridReport, cxGridCustomPopupMenu, cxGridPopupMenu,
|
||
cxPC, cxSplitter, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
|
||
IdFTP, ShellAPI, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
||
dxBarBuiltInMenu, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges,
|
||
IdExplicitTLSClientServerBase, U_BaseList, cxCheckBox, cxDropDownEdit;
|
||
|
||
type
|
||
TfrmDyePlanList = class(TfrmBaseList)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBAdd: TToolButton;
|
||
TBEdit: TToolButton;
|
||
TBDel: TToolButton;
|
||
TBPrint: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
Label1: TLabel;
|
||
Tv1: TcxGridDBTableView;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
cxGrid1: TcxGrid;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
Label3: TLabel;
|
||
OrderNo: TEdit;
|
||
TBExport: TToolButton;
|
||
v1OrderNo: TcxGridDBColumn;
|
||
v1OrdDate: TcxGridDBColumn;
|
||
v1DeliveryDate: TcxGridDBColumn;
|
||
v1ConNo: TcxGridDBColumn;
|
||
v1MPRTSpec: TcxGridDBColumn;
|
||
Order_Main: TClientDataSet;
|
||
v1CustomerNoName: TcxGridDBColumn;
|
||
Label4: TLabel;
|
||
CustName: TEdit;
|
||
v1MPRTCodeName: TcxGridDBColumn;
|
||
v1MPRTMF: TcxGridDBColumn;
|
||
PM_1: TPopupMenu;
|
||
N2: TMenuItem;
|
||
ToolButton1: TToolButton;
|
||
Label8: TLabel;
|
||
C_Name: TEdit;
|
||
Label9: TLabel;
|
||
ConNo: TEdit;
|
||
v1MPRTKZ: TcxGridDBColumn;
|
||
Label10: TLabel;
|
||
C_Spec: TEdit;
|
||
Label11: TLabel;
|
||
C_Code: TEdit;
|
||
Label12: TLabel;
|
||
MPRTKZ: TEdit;
|
||
TBcopy: TToolButton;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
cxSplitter1: TcxSplitter;
|
||
DS_2: TDataSource;
|
||
cxTabControl1: TcxTabControl;
|
||
Tchk: TToolButton;
|
||
Tnochk: TToolButton;
|
||
TWC: TToolButton;
|
||
TNowc: TToolButton;
|
||
v1Column6: TcxGridDBColumn;
|
||
Panel2: TPanel;
|
||
ADOQueryImage: TADOQuery;
|
||
DSImage: TDataSource;
|
||
IdFTP1: TIdFTP;
|
||
v1Column4: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
Tv1Column8: TcxGridDBColumn;
|
||
Tv1Column14: TcxGridDBColumn;
|
||
Tv1Column16: TcxGridDBColumn;
|
||
Tv1Column17: TcxGridDBColumn;
|
||
ToolButton2: TToolButton;
|
||
N1: TMenuItem;
|
||
CDS_2: TClientDataSet;
|
||
cxGrid2: TcxGrid;
|
||
TV2: TcxGridDBTableView;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
v1SOrddefstr1: TcxGridDBColumn;
|
||
v1PRTColor: TcxGridDBColumn;
|
||
v1PRTORDQTY: TcxGridDBColumn;
|
||
v1OrderUnit: TcxGridDBColumn;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
Tv1Column3: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
Tv1Column2: TcxGridDBColumn;
|
||
ToolButton3: TToolButton;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure TBEditClick(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBPrintClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure TBAddClick(Sender: TObject);
|
||
procedure OrderNoChange(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure CheckBox1Click(Sender: TObject);
|
||
procedure CheckBox2Click(Sender: TObject);
|
||
procedure Tv1StylesGetContentStyle(Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
||
procedure v1DeliveryDateCustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure TBcopyClick(Sender: TObject);
|
||
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure TchkClick(Sender: TObject);
|
||
procedure TnochkClick(Sender: TObject);
|
||
procedure TWCClick(Sender: TObject);
|
||
procedure TNowcClick(Sender: TObject);
|
||
procedure Picture4DblClick(Sender: TObject);
|
||
procedure Label3DblClick(Sender: TObject);
|
||
procedure Label9DblClick(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
private
|
||
DQdate: TDateTime;
|
||
procedure InitGrid();
|
||
function DelData(): Boolean;
|
||
procedure InitSub();
|
||
procedure SetStatus();
|
||
procedure InitImage(fwbid: string);
|
||
{ Private declarations }
|
||
public
|
||
FFInt, FCloth: Integer;
|
||
canshu1, canshu2, FWorkshop: string;
|
||
fFlileFlag: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmDyePlanList: TfrmDyePlanList;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_DyePlanInPut, U_RTFun, U_LabelPrint, U_DyeInspSet;
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmDyePlanList.InitImage(fwbid: string);
|
||
begin
|
||
ADOQueryImage.close;
|
||
if fwbid = '' then
|
||
exit;
|
||
with ADOQueryImage do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from TP_File A');
|
||
sql.Add('where WBID=' + quotedstr(trim(fwbid)));
|
||
open;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.SetStatus();
|
||
begin
|
||
|
||
TBadd.Enabled := false; //<2F><><EFBFBD><EFBFBD>
|
||
tbedit.Enabled := false; //<2F><EFBFBD>
|
||
tbdel.Enabled := false; //ɾ<><C9BE>
|
||
TBcopy.Enabled := false; //<2F><><EFBFBD><EFBFBD>
|
||
tchk.Enabled := false; //<2F><><EFBFBD><EFBFBD>
|
||
tnochk.Enabled := false; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
twc.Enabled := false; //<2F><><EFBFBD><EFBFBD>
|
||
tNOwc.Enabled := false; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
|
||
if Trim(canshu1) = '<27><><EFBFBD><EFBFBD>' then
|
||
begin
|
||
TBadd.Enabled := true;
|
||
TBcopy.Enabled := true;
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
tbedit.Enabled := true;
|
||
tbdel.Enabled := true;
|
||
tchk.Enabled := true;
|
||
end;
|
||
1:
|
||
begin
|
||
twc.Enabled := true;
|
||
tnochk.Enabled := true;
|
||
end;
|
||
2:
|
||
begin
|
||
tNOwc.Enabled := true;
|
||
end;
|
||
3:
|
||
begin
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
if Trim(canshu1) = '¼<><C2BC>' then
|
||
begin
|
||
TBadd.Enabled := true;
|
||
TBcopy.Enabled := true;
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
// tchk.Visible:=true;
|
||
tbedit.Enabled := true;
|
||
tbdel.Enabled := true;
|
||
// TBQX.Visible:=true;
|
||
end;
|
||
1:
|
||
begin
|
||
// tnochk.Visible:=true;
|
||
end;
|
||
2:
|
||
begin
|
||
end;
|
||
3:
|
||
begin
|
||
// TBNOQX.Visible:=true;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.InitSub();
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from Dye_Plan_Sub ');
|
||
sql.Add('where mainID =' + quotedstr((Order_Main.fieldbyname('mainID').AsString)));
|
||
open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, CDS_2);
|
||
SInitCDSData(ADOQueryTemp, CDS_2);
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.Label3DblClick(Sender: TObject);
|
||
var
|
||
I: Integer;
|
||
Column: TcxGridDBColumn;
|
||
FieldNames: TStringList;
|
||
begin
|
||
FieldNames := TStringList.Create;
|
||
try
|
||
for I := 0 to Tv1.ColumnCount - 1 do
|
||
begin
|
||
Column := Tv1.Columns[I];
|
||
FieldNames.Add(Column.Caption + ':' + Column.DataBinding.FieldName);
|
||
end;
|
||
ShowMessage(FieldNames.Text);
|
||
finally
|
||
FieldNames.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.Label9DblClick(Sender: TObject);
|
||
var
|
||
I: Integer;
|
||
Column: TcxGridDBColumn;
|
||
FieldNames: TStringList;
|
||
begin
|
||
FieldNames := TStringList.Create;
|
||
try
|
||
for I := 0 to Tv2.ColumnCount - 1 do
|
||
begin
|
||
Column := Tv2.Columns[I];
|
||
FieldNames.Add(Column.Caption + ':' + Column.DataBinding.FieldName);
|
||
end;
|
||
ShowMessage(FieldNames.Text);
|
||
finally
|
||
FieldNames.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.FormDestroy(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmDyePlanList := nil;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.FormCreate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
cxgrid1.Align := alClient;
|
||
DQdate := SGetServerDate(ADOQueryTemp);
|
||
canshu1 := trim(Self.fParameters1);
|
||
canshu2 := trim(Self.fParameters2);
|
||
FWorkshop := trim(Self.fParameters3);
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.InitGrid();
|
||
begin
|
||
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
Filtered := False;
|
||
sql.Clear;
|
||
sql.Add('select A.*, B.*');
|
||
sql.Add('from Dye_Plan_MAIN A');
|
||
sql.Add('inner join Dye_Plan_Sub B on B.MainId=A.MainId');
|
||
sql.Add(' where 1=1');
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
sql.Add(' and isnull(A.status,''0'')=''0'' ');
|
||
end;
|
||
1:
|
||
begin
|
||
sql.Add(' and isnull(A.status,''0'')=''9'' ');
|
||
end;
|
||
2:
|
||
begin
|
||
sql.Add(' and isnull(A.status,''0'')=''10'' ');
|
||
end;
|
||
end;
|
||
sql.Add(' and OrdDate>=''' + FormatDateTime('yyyy-MM-dd', begdate.DateTime) + ''' ');
|
||
sql.Add(' and OrdDate<''' + FormatDateTime('yyyy-MM-dd', Enddate.DateTime + 1) + ''' ');
|
||
sql.Add(' and A.Workshop=''' + trim(FWorkshop) + ''' ');
|
||
if Trim(canshu1) = '¼<><C2BC>' then
|
||
sql.Add('and Filler=' + QuotedStr(Trim(DName)));
|
||
// ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, Order_Main);
|
||
SInitCDSData(ADOQueryMain, Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, Order_Main);
|
||
SInitCDSData(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.TBEditClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
{ if Trim(Order_Main.fieldbyname('Filler').AsString)<>Trim(DName) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
try
|
||
frmDyePlanInPut := TfrmDyePlanInPut.Create(Application);
|
||
with frmDyePlanInPut do
|
||
begin
|
||
PState := 1;
|
||
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
FOrderNo := Trim(Self.Order_Main.fieldbyname('OrderNo').AsString);
|
||
canshu1 := self.canshu1;
|
||
canshu2 := self.canshu2;
|
||
FWorkshop := self.FWorkshop;
|
||
conNo.Enabled := false;
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmDyePlanInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.TBDelClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
if not Order_Main.Locate('SSel', True, []) then
|
||
begin
|
||
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
while Order_Main.Locate('SSel', True, []) do
|
||
begin
|
||
if (Trim(Order_Main.fieldbyname('Filler').AsString) <> Trim(DName)) and (dname <> 'ADMIN') then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Dye_Plan_Card where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if not ADOQueryTemp.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Dye_Cloth_Inspect where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
|
||
if ADOQueryTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27>Ѽ<EFBFBD><D1BC>鲻<EFBFBD><E9B2BB>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if DelData() then
|
||
begin
|
||
|
||
end;
|
||
Order_Main.Delete;
|
||
end;
|
||
|
||
end;
|
||
|
||
function TfrmDyePlanList.DelData(): Boolean;
|
||
begin
|
||
try
|
||
Result := false;
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Dye_Plan_Main where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add('delete Dye_Plan_Sub where MainId=''' + Trim(Order_Main.fieldbyname('MainId').AsString) + '''');
|
||
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
||
sql.Add(' ' + quotedstr(trim(DName)));
|
||
sql.Add(',getdate() ');
|
||
sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
sql.Add(',' + quotedstr(trim('ָʾ<D6B8><CABE>ɾ<EFBFBD><C9BE>')));
|
||
sql.Add(',' + quotedstr(trim('ָʾ<D6B8><CABE><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('OrderNO').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
ExecSQL;
|
||
end;
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Result := False;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
Exit;
|
||
// SelExportData(Tv1,ADOQueryMain,self.Caption);
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.TBPrintClick(Sender: TObject);
|
||
var
|
||
WSql: string;
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
WSql := QuotedStr(Trim(Order_Main.fieldbyname('MainId').AsString));
|
||
|
||
try
|
||
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
||
with frmLabelPrint do
|
||
begin
|
||
FLMType := 'DyePlanPrint';
|
||
FFiltration1 := WSql;
|
||
if ShowModal = 1 then
|
||
begin
|
||
// Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmLabelPrint.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.TBAddClick(Sender: TObject);
|
||
var
|
||
maxno: string;
|
||
begin
|
||
try
|
||
frmDyePlanInPut := TfrmDyePlanInPut.Create(Application);
|
||
with frmDyePlanInPut do
|
||
begin
|
||
PState := 0;
|
||
FMainId := '';
|
||
canshu1 := self.canshu1;
|
||
canshu2 := self.canshu2;
|
||
FWorkshop := self.FWorkshop;
|
||
if ShowModal = 1 then
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmDyePlanInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.OrderNoChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, Order_Main);
|
||
SInitCDSData(ADOQueryMain, Order_Main);
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
fFlileFlag := UserDataFlag + 'HX';
|
||
canshu1 := self.fParameters1;
|
||
canshu2 := self.fParameters2;
|
||
FWorkshop := self.fParameters3;
|
||
BegDate.DateTime := SGetServerDate(ADOQueryTemp) - 15;
|
||
EndDate.DateTime := SGetServerDate(ADOQueryTemp);
|
||
ReadCxGrid(self.Caption + 'TV1', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
ReadCxGrid(self.Caption + 'TV2', Tv2, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
SetStatus();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
if ToolButton1.Visible = False then
|
||
Exit;
|
||
TBPrint.Click;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.CheckBox1Click(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.CheckBox2Click(Sender: TObject);
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.Tv1StylesGetContentStyle(Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
||
var
|
||
id, id10: Integer;
|
||
begin
|
||
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.v1DeliveryDateCustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||
begin
|
||
{ Id:=TV1.GetColumnByFieldName('DeliveryDate').Index;//;-TV1.GroupedItemCount;
|
||
Id10:=TV1.GetColumnByFieldName('SubStatus').Index;
|
||
if Id<0 then Exit;
|
||
if AViewInfo.GridRecord.Values[Id10]='<27><><EFBFBD><EFBFBD>' then Exit;
|
||
if AViewInfo.GridRecord.Values[Id]-SGetServerDate(ADOQueryTemp)>=4 then Exit;
|
||
if ((AViewInfo.GridRecord.Values[id]-SGetServerDate(ADOQueryTemp))>=0) and ((AViewInfo.GridRecord.Values[id]-SGetServerDate(ADOQueryTemp))<4) then
|
||
ACanvas.Brush.Color:=clYellow
|
||
else
|
||
if (AViewInfo.GridRecord.Values[id])-(SGetServerDate(ADOQueryTemp)<0) then
|
||
begin
|
||
ACanvas.Brush.Color:=clRed;
|
||
end;
|
||
begin
|
||
ACanvas.Brush.Color:=clRed;
|
||
end else
|
||
if AViewInfo.GridRecord.Values[Id]='Purple' then
|
||
begin
|
||
ACanvas.Brush.Color:=clPurple;
|
||
end else
|
||
if AViewInfo.GridRecord.Values[Id]='Olive' then
|
||
begin
|
||
ACanvas.Brush.Color:=clOlive;
|
||
end else
|
||
if AViewInfo.GridRecord.Values[Id]='Teal' then
|
||
begin
|
||
ACanvas.Brush.Color:=clTeal;
|
||
end else
|
||
if AViewInfo.GridRecord.Values[Id]='Background' then
|
||
begin
|
||
ACanvas.Brush.Color:=clBackground;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNoFiler(Tv1, false);
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.N2Click(Sender: TObject);
|
||
begin
|
||
|
||
SelOKNoFiler(Tv1, true);
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
try
|
||
frmDyePlanInPut := TfrmDyePlanInPut.Create(Application);
|
||
with frmDyePlanInPut do
|
||
begin
|
||
PState := 1;
|
||
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
ToolBar2.Visible := False;
|
||
TBSave.Visible := False;
|
||
ScrollBox1.Enabled := False;
|
||
Tv1.OptionsSelection.CellSelect := False;
|
||
FWorkshop := self.FWorkshop;
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmDyePlanInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(self.Caption + 'TV1', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
WriteCxGrid(self.Caption + 'TV2', Tv2, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmDyeInspSet := TfrmDyeInspSet.Create(Application);
|
||
with frmDyeInspSet do
|
||
begin
|
||
|
||
FDataID := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmDyeInspSet.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.TBcopyClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
Exit;
|
||
try
|
||
frmDyePlanInPut := TfrmDyePlanInPut.Create(Application);
|
||
with frmDyePlanInPut do
|
||
begin
|
||
PState := 1;
|
||
CopyInt := 99;
|
||
FMainId := Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
canshu1 := self.canshu1;
|
||
canshu2 := self.canshu2;
|
||
FWorkshop := self.FWorkshop;
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmDyePlanInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
begin
|
||
InitSub();
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
SetStatus();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.TchkClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
if not Order_Main.Locate('SSel', True, []) then
|
||
begin
|
||
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
while Order_Main.Locate('SSel', True, []) do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Dye_Plan_Main SET status=''9'' ');
|
||
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
||
sql.Add(' ' + quotedstr(trim(DName)));
|
||
sql.Add(',getdate() ');
|
||
sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('orderNO').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
Order_Main.Delete;
|
||
end;
|
||
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.TnochkClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
if not Order_Main.Locate('SSel', True, []) then
|
||
begin
|
||
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
while Order_Main.Locate('SSel', True, []) do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Dye_Plan_Main SET status=''0'' ');
|
||
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
||
sql.Add(' ' + quotedstr(trim(DName)));
|
||
sql.Add(',getdate() ');
|
||
sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('orderNO').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
Order_Main.Delete;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.TWCClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
if not Order_Main.Locate('SSel', True, []) then
|
||
begin
|
||
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
while Order_Main.Locate('SSel', True, []) do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Dye_Plan_Main SET status=''10'' ');
|
||
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
||
sql.Add(' ' + quotedstr(trim(DName)));
|
||
sql.Add(',getdate() ');
|
||
sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('orderNO').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
Order_Main.Delete;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɳɹ<C9B3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyePlanList.TNowcClick(Sender: TObject);
|
||
begin
|
||
if Order_Main.IsEmpty then
|
||
exit;
|
||
if not Order_Main.Locate('SSel', True, []) then
|
||
begin
|
||
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
while Order_Main.Locate('SSel', True, []) do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update Dye_Plan_Main SET status=''9'' ');
|
||
sql.Add('where mainID=' + quotedstr(trim(Order_Main.fieldbyname('mainID').AsString)));
|
||
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
||
sql.Add(' ' + quotedstr(trim(DName)));
|
||
sql.Add(',getdate() ');
|
||
sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(Order_Main.FieldByName('orderNO').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
Order_Main.Delete;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɳɹ<C9B3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
//procedure TfrmDyePlanList.TV2FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
//begin
|
||
// initImage(ADOQuerySub.fieldbyname('HXFile').AsString);
|
||
//end;
|
||
|
||
procedure TfrmDyePlanList.Picture4DblClick(Sender: TObject);
|
||
var
|
||
sFieldName: string;
|
||
fileName: string;
|
||
// ff: TADOBlobStream;
|
||
// FJStream : TMemoryStream;
|
||
begin
|
||
// if Picture4.Picture.Height = 0 then
|
||
// exit;
|
||
sFieldName := leftbstr(ExtractFilePath(Application.ExeName), 1) + ':\ͼƬ<CDBC>鿴';
|
||
|
||
if not DirectoryExists(pchar(sFieldName)) then
|
||
CreateDirectory(pchar(sFieldName), nil);
|
||
// fileName := ADOQuerySub.fieldbyname('hxFile').AsString;
|
||
sFieldName := sFieldName + '\' + trim(fileName);
|
||
|
||
try
|
||
IdFTP1.Host := ReadINIFileStr('SYSTEMSET.INI', 'SERVER', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ', '127.0.0.1');
|
||
IdFTP1.Username := 'three';
|
||
IdFTP1.Password := '641010';
|
||
IdFTP1.Connect();
|
||
except
|
||
;
|
||
end;
|
||
|
||
if IdFTP1.Connected then
|
||
begin
|
||
|
||
application.ProcessMessages;
|
||
try
|
||
IdFTP1.Get(fFlileFlag + '\' + Trim(fileName), sFieldName, true, false);
|
||
except
|
||
Application.MessageBox('<27>ͻ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
|
||
IdFTP1.Quit;
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox('<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
|
||
IdFTP1.Quit;
|
||
Exit;
|
||
end;
|
||
if IdFTP1.Connected then
|
||
IdFTP1.Quit;
|
||
ShellExecute(Handle, 'open', PChar(sFieldName), '', '', SW_SHOWNORMAL);
|
||
|
||
end;
|
||
|
||
end.
|
||
|