473 lines
12 KiB
ObjectPascal
473 lines
12 KiB
ObjectPascal
unit U_DyeCardRoll;
|
||
|
||
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,
|
||
dxScrollbarAnnotations;
|
||
|
||
type
|
||
TfrmDyeCardRoll = class(TfrmBaseList)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: 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;
|
||
Order_Main: TClientDataSet;
|
||
PM_1: TPopupMenu;
|
||
N2: TMenuItem;
|
||
Label8: TLabel;
|
||
RollNumber: TEdit;
|
||
Label11: TLabel;
|
||
PCID: TEdit;
|
||
Label12: TLabel;
|
||
MPRTKZ: TEdit;
|
||
DS_2: TDataSource;
|
||
cxTabControl1: TcxTabControl;
|
||
ADOQueryImage: TADOQuery;
|
||
DSImage: TDataSource;
|
||
IdFTP1: TIdFTP;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
ToolButton2: TToolButton;
|
||
N1: TMenuItem;
|
||
CDS_2: TClientDataSet;
|
||
Tv1OrderNo: TcxGridDBColumn;
|
||
Tv1QtyOrder: TcxGridDBColumn;
|
||
Tv1PCID: TcxGridDBColumn;
|
||
Tv1KaZu: TcxGridDBColumn;
|
||
Tv1KaZuPiece: TcxGridDBColumn;
|
||
Tv1KaZuQty: TcxGridDBColumn;
|
||
Tv1RollNumber: TcxGridDBColumn;
|
||
Tv1CCQXRollMeter: TcxGridDBColumn;
|
||
Tv1RGQXRollMeter: TcxGridDBColumn;
|
||
Tv1JGQXRollMeter: TcxGridDBColumn;
|
||
Tv1DXRollMeter: TcxGridDBColumn;
|
||
Tv1FSRollMeter: TcxGridDBColumn;
|
||
Tv1FPRollMeter: TcxGridDBColumn;
|
||
Tv1GJRollMeter: TcxGridDBColumn;
|
||
Tv1ZMRollMeter: TcxGridDBColumn;
|
||
Tv1C_Name: TcxGridDBColumn;
|
||
Tv1F_Name: TcxGridDBColumn;
|
||
Tv1C_PlanQty: TcxGridDBColumn;
|
||
Tv1F_description: TcxGridDBColumn;
|
||
Tv1C_description: TcxGridDBColumn;
|
||
Tv1PCType: TcxGridDBColumn;
|
||
Tv1PCTime: TcxGridDBColumn;
|
||
Tv1C_Width: TcxGridDBColumn;
|
||
Tv1C_GramWeight: TcxGridDBColumn;
|
||
Tv1DTMPSlist: TcxGridDBColumn;
|
||
Tv1CINote: TcxGridDBColumn;
|
||
Tv1C_Color: TcxGridDBColumn;
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBPrintClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure OrderNoChange(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
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 cxTabControl1Change(Sender: TObject);
|
||
procedure Label3DblClick(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
|
||
private
|
||
DQdate: TDateTime;
|
||
procedure InitGrid();
|
||
function DelData(): Boolean;
|
||
procedure SetStatus();
|
||
procedure InitImage(fwbid: string);
|
||
{ Private declarations }
|
||
public
|
||
FFInt, FCloth: Integer;
|
||
canshu1, canshu2, FWorkshop: string;
|
||
fFlileFlag: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmDyeCardRoll: TfrmDyeCardRoll;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_LabelPrint;
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmDyeCardRoll.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 TfrmDyeCardRoll.SetStatus();
|
||
begin
|
||
|
||
|
||
|
||
|
||
if Trim(canshu1) = '<27><><EFBFBD><EFBFBD>' then
|
||
begin
|
||
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
|
||
|
||
end;
|
||
1:
|
||
begin
|
||
|
||
|
||
end;
|
||
2:
|
||
begin
|
||
|
||
end;
|
||
3:
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
if Trim(canshu1) = '¼<><C2BC>' then
|
||
begin
|
||
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
|
||
|
||
end;
|
||
1:
|
||
begin
|
||
// tnochk.Visible:=true;
|
||
end;
|
||
2:
|
||
begin
|
||
end;
|
||
3:
|
||
begin
|
||
// TBNOQX.Visible:=true;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmDyeCardRoll.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 TfrmDyeCardRoll.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmDyeCardRoll.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 TfrmDyeCardRoll.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
|
||
end;
|
||
|
||
procedure TfrmDyeCardRoll.InitGrid();
|
||
begin
|
||
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
Filtered := False;
|
||
sql.Clear;
|
||
sql.Add('select A.* ');
|
||
sql.Add('from V_Dye_Card_Roll A');
|
||
sql.Add(' where 1=1');
|
||
// case cxTabControl1.TabIndex of
|
||
// 0:
|
||
// begin
|
||
// sql.Add(' and isnull(A.status,''0'') in(''<27>Ѽƻ<D1BC>'') ');
|
||
// end;
|
||
// 1:
|
||
// begin
|
||
// sql.Add(' and isnull(A.status,''0'')in(''<27><><EFBFBD>´<EFBFBD>'' )');
|
||
// end;
|
||
// 2:
|
||
// begin
|
||
// sql.Add(' and isnull(A.status,''0'')in(''<27>ѽ<EFBFBD><D1BD><EFBFBD>'' )');
|
||
// end;
|
||
// 3:
|
||
// begin
|
||
// sql.Add(' and isnull(A.status,''0'')in(''<27><>ȡ<EFBFBD><C8A1>'' )');
|
||
// end;
|
||
// 4:
|
||
// begin
|
||
// sql.Add(' and isnull(A.status,''0'')in(''<27>ѽ<EFBFBD><D1BD><EFBFBD>'' )');
|
||
// end;
|
||
// end;
|
||
sql.Add(' and fillTime>=''' + FormatDateTime('yyyy-MM-dd', begdate.DateTime) + ''' ');
|
||
sql.Add(' and fillTime<''' + 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 TfrmDyeCardRoll.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;
|
||
|
||
|
||
|
||
function TfrmDyeCardRoll.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 TfrmDyeCardRoll.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
Exit;
|
||
end;
|
||
|
||
procedure TfrmDyeCardRoll.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 TfrmDyeCardRoll.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmDyeCardRoll.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 TfrmDyeCardRoll.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><EFBFBD><D7AE><EFBFBD><EFBFBD>');
|
||
|
||
SetStatus();
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmDyeCardRoll.CheckBox1Click(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmDyeCardRoll.CheckBox2Click(Sender: TObject);
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
|
||
procedure TfrmDyeCardRoll.Tv1StylesGetContentStyle(Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
||
var
|
||
id, id10: Integer;
|
||
begin
|
||
|
||
end;
|
||
|
||
procedure TfrmDyeCardRoll.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 TfrmDyeCardRoll.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNoFiler(Tv1, false);
|
||
end;
|
||
|
||
procedure TfrmDyeCardRoll.N2Click(Sender: TObject);
|
||
begin
|
||
|
||
SelOKNoFiler(Tv1, true);
|
||
end;
|
||
|
||
procedure TfrmDyeCardRoll.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(self.Caption + 'TV1', Tv1, '<27><><EFBFBD><EFBFBD><EFBFBD><D7AE><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
|
||
|
||
|
||
|
||
procedure TfrmDyeCardRoll.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
SetStatus();
|
||
InitGrid();
|
||
end;
|
||
|
||
end.
|
||
|