D10sxYilanbuyi/F04染色刷卡/U_DyePCDetailsList.pas
2025-11-16 11:45:01 +08:00

1098 lines
35 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_DyePCDetailsList;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
cxEdit, DB, cxDBData, cxGridCustomTableView, cxGridTableView,
cxGridBandedTableView, cxGridDBBandedTableView, cxGridLevel, cxClasses,
cxControls, cxGridCustomView, cxGridDBTableView, cxGrid, StdCtrls, ComCtrls,
ExtCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, ADODB, DBClient,
cxDropDownEdit, MovePanel, cxButtonEdit, cxCalendar, RM_System, RM_Common,
RM_Class, RM_GridReport, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu,
U_BaseList, dxScrollbarAnnotations, cxContainer, cxTextEdit, cxMaskEdit,
Vcl.Menus, cxButtons;
type
TfrmDyePCDetailsList = class(TfrmBaseList)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBFind: TToolButton;
TBExport: TToolButton;
TBPrint: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
DS_1: TDataSource;
GPM1: TcxGridPopupMenu;
Label3: TLabel;
pcid: TEdit;
CDS_1: TClientDataSet;
MovePanel2: TMovePanel;
RMGridReport1: TRMGridReport;
customerNoName: TEdit;
Label13: TLabel;
ywy: TEdit;
Label17: TLabel;
lbHx: TEdit;
Label7: TLabel;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
Label1: TLabel;
Label2: TLabel;
BegTime: TDateTimePicker;
EndTime: TDateTimePicker;
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
TbUpdateTime: TToolButton;
Panel2: TPanel;
Tv1: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
cxGrid1: TcxGrid;
Tv1PCID: TcxGridDBColumn;
Tv1OrderNo: TcxGridDBColumn;
Tv1C_Name: TcxGridDBColumn;
Tv1PSName: TcxGridDBColumn;
Tv1CALL_temperature6: TcxGridDBColumn;
Tv1PCQty: TcxGridDBColumn;
Tv1time: TcxGridDBColumn;
Tv1BegTime: TcxGridDBColumn;
Tv1EndTime: TcxGridDBColumn;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
cxGridDBColumn2: TcxGridDBColumn;
cxGridDBColumn3: TcxGridDBColumn;
cxGridDBColumn4: TcxGridDBColumn;
cxGridDBColumn5: TcxGridDBColumn;
cxGridDBColumn6: TcxGridDBColumn;
cxGridDBColumn7: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
DS_2: TDataSource;
CDS_2: TClientDataSet;
GPM2: TcxGridPopupMenu;
Tv2PC_FLAG: TcxGridDBColumn;
Tv2isComplete: TcxGridDBColumn;
MCNO: TcxButtonEdit;
MCName: TEdit;
Label4: TLabel;
cxButton1: TcxButton;
cxButton2: TcxButton;
TbMoveUp: TcxButton;
TbMoveDown: TcxButton;
Tv1GlideID: TcxGridDBColumn;
Tv2GlideID: TcxGridDBColumn;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure ConNoMChange(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TBExportClick(Sender: TObject);
procedure TBFindClick(Sender: TObject);
procedure pcidChange(Sender: TObject);
procedure PRTColorChange(Sender: TObject);
procedure TBdelClick(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
procedure tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
procedure TbUpdateTimeClick(Sender: TObject);
procedure MCNOPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure Tv2KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure Tv1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure cxButton1Click(Sender: TObject);
procedure Tv2CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
procedure cxButton2Click(Sender: TObject);
procedure Tv1BegTimePropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
procedure TbMoveUpClick(Sender: TObject);
procedure TbMoveDownClick(Sender: TObject);
private
FLeft, FTop: Integer;
procedure InitGrid1();
procedure InitGrid2();
function SaveData(): boolean;
function GetLastLine(const AText: string): string;
function SaveMove(const Flag: string): Boolean;
{ Private declarations }
public
fsyrName, canshu1: string;
{ Public declarations }
end;
var
frmDyePCDetailsList: TfrmDyePCDetailsList;
implementation
uses
U_DataLink, U_RTFun, U_ZDYHelp, U_MachTaskList, U_BS_MachineSel;
{$R *.dfm}
procedure TfrmDyePCDetailsList.FormDestroy(Sender: TObject);
begin
inherited;
frmDyePCDetailsList := nil;
end;
procedure TfrmDyePCDetailsList.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
case Key of
VK_ESCAPE:
begin
Key := 0; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Close;
end;
end;
end;
function TfrmDyePCDetailsList.SaveData(): boolean;
var
mLoopNum: Integer;
mMCName, mNewValue, mStartTime: string;
mEndTime, mBegTime: string;
begin
result := false;
ADOQueryCmd.Connection.BeginTrans;
try
mLoopNum := StrToInt(CDS_1.FieldByName('Time').AsString) div 10;
if (MCNO.Text <> '') and (CDS_1.FieldByName('BegTime').AsString <> '') then
begin
with ADOQueryCmd do
begin
Close;
SQL.Clear;
SQL.Add(' update Dye_Plan_Glide set PC_FLAG = 1 , EndTime = DATEADD(MINUTE, ' + CDS_1.FieldByName('time').AsString + ', ' + QuotedStr(trim(CDS_1.FieldByName('BegTime').AsString)) + ')');
SQL.Add(' , begTime = ' + QuotedStr(Trim(CDS_1.FieldByName('BegTime').AsString)));
SQL.Add(' , MCNO = ' + QuotedStr(Trim(MCNO.Text)));
SQL.Add(' , MCName = ' + QuotedStr(MCName.Text));
SQL.Add(' where GlideID = ' + QuotedStr(Trim(CDS_1.FieldByName('GlideID').asString)));
// ShowMessage(sql.Text);
ExecSQL;
end;
mMCName := MCName.Text;
mStartTime := CDS_1.FieldByName('BegTime').AsString;
// mNewValue := '<27>ƻ<EFBFBD><C6BB><EFBFBD>:' + CDS_1.FieldByName('OrderNo').AsString + #13;
mNewValue := mNewValue + CDS_1.FieldByName('C_Name').AsString + #13;
mNewValue := mNewValue + '<27><>Ʒ<EFBFBD>ŷ<EFBFBD><C5B7><EFBFBD>' + CDS_1.FieldByName('C_Width').AsString + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD> <20>ν<EFBFBD><CEBD><EFBFBD><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('GlideName').AsString;
if CDS_1.FieldByName('PSType').AsString = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ' then
begin
mNewValue := mNewValue + '' + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_Speed').AsString + #13;
mNewValue := mNewValue + '<27><EFBFBD>6#:' + CDS_1.FieldByName('ALL_temperature6').AsString + #13;
end
else if CDS_1.FieldByName('PSType').AsString = '<27>ɶ<EFBFBD><C9B6><EFBFBD>' then
begin
mNewValue := mNewValue + '' + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_Speed').AsString + #13;
mNewValue := mNewValue + '<27><EFBFBD>6#:' + CDS_1.FieldByName('ALL_temperature6').AsString + #13;
end
else if CDS_1.FieldByName('PSType').AsString = '<27><>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD>' then
begin
mNewValue := mNewValue + '' + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_Speed').AsString + #13;
mNewValue := mNewValue + '<27><EFBFBD>6#:' + CDS_1.FieldByName('ALL_temperature6').AsString + #13;
end
else if CDS_1.FieldByName('PSType').AsString = '<27>ν<EFBFBD>' then
begin
mNewValue := mNewValue + '' + CDS_1.FieldByName('gj_number').AsString + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_Speed').AsString + #13;
mNewValue := mNewValue + '<27><EFBFBD>6#:' + CDS_1.FieldByName('ALL_temperature6').AsString + #13;
end
else if CDS_1.FieldByName('PSType').AsString = '<27><><EFBFBD><EFBFBD>' then
begin
mNewValue := mNewValue + ' ' + CDS_1.FieldByName('fp_gjNumber').AsString + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_Speed').AsString + #13;
mNewValue := mNewValue + '<27><EFBFBD>6#:' + CDS_1.FieldByName('ALL_temperature6').AsString + #13;
end
else if CDS_1.FieldByName('PSType').AsString = '<27><>ë' then
begin
mNewValue := mNewValue + '' + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_Speed').AsString + #13;
mNewValue := mNewValue + '<27><EFBFBD>6#:' + CDS_1.FieldByName('ALL_temperature6').AsString + #13;
end
else if CDS_1.FieldByName('PSType').AsString = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ' then
begin
mNewValue := mNewValue + '' + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_Speed').AsString + #13;
mNewValue := mNewValue + '<27><EFBFBD>6#:' + CDS_1.FieldByName('ALL_temperature6').AsString + #13;
end
else if CDS_1.FieldByName('PSType').AsString = '<27><>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD>ϴ' then
begin
mNewValue := mNewValue + '' + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_Speed').AsString + #13;
mNewValue := mNewValue + '<27><EFBFBD>6#:' + CDS_1.FieldByName('ALL_temperature6').AsString + #13;
end
else
begin
mNewValue := mNewValue + '' + #13;
end;
//////////////////////<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_zhuji').AsString + #13;
mNewValue := mNewValue + CDS_1.FieldByName('PCID').AsString + #13;
mNewValue := mNewValue + CDS_1.FieldByName('GlideID').AsString;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
SQL.Add('EXEC P_PC_UpdatePCAboutTime ' + '@MCName = :MCName, ' + '@NewValue = :NewValue, ' + '@StartTime = :StartTime, ' + '@LoopNum = :LoopNum');
Parameters.ParamByName('MCName').Value := mMCName;
Parameters.ParamByName('NewValue').Value := mNewValue;
Parameters.ParamByName('StartTime').Value := mStartTime;
Parameters.ParamByName('LoopNum').Value := mLoopNum;
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
SQL.Add('select * from PCAboutTime ');
SQL.Add(' where time >= ' + quotedStr(Trim(mStartTime)));
Open;
end;
ADOQueryCmd.First;
mNewValue := ADOQueryCmd.FieldByName(mMCName).AsString;
mBegTime := ADOQueryCmd.FieldByName('time').AsString;
mEndTime := ADOQueryCmd.FieldByName('time').AsString;
while not ADOQueryCmd.Eof do
begin
if (ADOQueryCmd.FieldByName(mMCName).AsString = null) or (ADOQueryCmd.FieldByName(mMCName).AsString = '') then
begin
mEndTime := ADOQueryCmd.FieldByName('time').AsString;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('update Dye_Plan_Glide set BegTime = ' + QuotedStr(Trim(mBegTime)));
sql.Add(' , EndTime = ' + QuotedStr(Trim(mEndTime)));
SQL.Add(' where GlideID = ' + QuotedStr(Trim(GetLastLine(mNewValue))));
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
result := true;
Exit;
end;
if mNewValue <> ADOQueryCmd.FieldByName(mMCName).AsString then
begin
mEndTime := ADOQueryCmd.FieldByName('time').AsString;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('update Dye_Plan_Glide set BegTime = ' + QuotedStr(Trim(mBegTime)));
sql.Add(' , EndTime = ' + QuotedStr(Trim(mEndTime)));
SQL.Add(' where GlideID = ' + QuotedStr(Trim(GetLastLine(mNewValue))));
ExecSQL;
end;
mBegTime := ADOQueryCmd.FieldByName('time').AsString;
mNewValue := ADOQueryCmd.FieldByName(mMCName).AsString;
end;
ADOQueryCmd.Next;
end;
end;
ADOQueryCmd.Connection.CommitTrans;
result := true;
except
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
result := false;
end;
end;
function TfrmDyePCDetailsList.SaveMove(const Flag: string): Boolean;
var
mLoopNum: Integer;
mMCName, mNewValue, mStartTime: string;
mEndTime, mBegTime: string;
begin
Result := False; // Ĭ<>Ϸ<EFBFBD><CFB7><EFBFBD>ʧ<EFBFBD><CAA7>
ADOQueryCmd.Connection.BeginTrans;
try
if Flag = '<27><><EFBFBD><EFBFBD>' then
begin
CDS_1.Prior;
mStartTime := CDS_1.FieldByName('BegTime').AsString;
CDS_1.Next;
end
else if Flag = '<27><><EFBFBD><EFBFBD>' then
begin
mStartTime := CDS_1.FieldByName('BegTime').AsString;
CDS_1.Next;
end;
mLoopNum := StrToInt(CDS_1.FieldByName('Time').AsString) div 10;
if (MCNO.Text <> '') and (CDS_1.FieldByName('BegTime').AsString <> '') then
begin
with ADOQueryCmd do
begin
Close;
SQL.Clear;
SQL.Add(' update Dye_Plan_Glide set PC_FLAG = 1 , EndTime = DATEADD(MINUTE, ' + CDS_1.FieldByName('time').AsString + ', ' + QuotedStr(trim(mStartTime)) + ')');
SQL.Add(' , begTime = ' + QuotedStr(Trim(mStartTime)));
SQL.Add(' , MCNO = ' + QuotedStr(Trim(MCNO.Text)));
SQL.Add(' , MCName = ' + QuotedStr(MCName.Text));
SQL.Add(' where GlideID = ' + QuotedStr(Trim(CDS_1.FieldByName('GlideID').asString)));
ExecSQL;
end;
mMCName := MCName.Text;
mNewValue := mNewValue + CDS_1.FieldByName('C_Name').AsString + #13;
mNewValue := mNewValue + '<27><>Ʒ<EFBFBD>ŷ<EFBFBD><C5B7><EFBFBD>' + CDS_1.FieldByName('C_Width').AsString + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD> <20>ν<EFBFBD><CEBD><EFBFBD><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('GlideName').AsString;
if CDS_1.FieldByName('PSType').AsString = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ' then
begin
mNewValue := mNewValue + '' + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_Speed').AsString + #13;
mNewValue := mNewValue + '<27><EFBFBD>6#:' + CDS_1.FieldByName('ALL_temperature6').AsString + #13;
end
else if CDS_1.FieldByName('PSType').AsString = '<27>ɶ<EFBFBD><C9B6><EFBFBD>' then
begin
mNewValue := mNewValue + '' + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_Speed').AsString + #13;
mNewValue := mNewValue + '<27><EFBFBD>6#:' + CDS_1.FieldByName('ALL_temperature6').AsString + #13;
end
else if CDS_1.FieldByName('PSType').AsString = '<27><>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD>' then
begin
mNewValue := mNewValue + '' + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_Speed').AsString + #13;
mNewValue := mNewValue + '<27><EFBFBD>6#:' + CDS_1.FieldByName('ALL_temperature6').AsString + #13;
end
else if CDS_1.FieldByName('PSType').AsString = '<27>ν<EFBFBD>' then
begin
mNewValue := mNewValue + '' + CDS_1.FieldByName('gj_number').AsString + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_Speed').AsString + #13;
mNewValue := mNewValue + '<27><EFBFBD>6#:' + CDS_1.FieldByName('ALL_temperature6').AsString + #13;
end
else if CDS_1.FieldByName('PSType').AsString = '<27><><EFBFBD><EFBFBD>' then
begin
mNewValue := mNewValue + ' ' + CDS_1.FieldByName('fp_gjNumber').AsString + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_Speed').AsString + #13;
mNewValue := mNewValue + '<27><EFBFBD>6#:' + CDS_1.FieldByName('ALL_temperature6').AsString + #13;
end
else if CDS_1.FieldByName('PSType').AsString = '<27><>ë' then
begin
mNewValue := mNewValue + '' + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_Speed').AsString + #13;
mNewValue := mNewValue + '<27><EFBFBD>6#:' + CDS_1.FieldByName('ALL_temperature6').AsString + #13;
end
else if CDS_1.FieldByName('PSType').AsString = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ' then
begin
mNewValue := mNewValue + '' + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_Speed').AsString + #13;
mNewValue := mNewValue + '<27><EFBFBD>6#:' + CDS_1.FieldByName('ALL_temperature6').AsString + #13;
end
else if CDS_1.FieldByName('PSType').AsString = '<27><>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD>ϴ' then
begin
mNewValue := mNewValue + '' + #13;
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_Speed').AsString + #13;
mNewValue := mNewValue + '<27><EFBFBD>6#:' + CDS_1.FieldByName('ALL_temperature6').AsString + #13;
end
else
begin
mNewValue := mNewValue + '' + #13;
end;
// <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
mNewValue := mNewValue + '<27><><EFBFBD><EFBFBD>:' + CDS_1.FieldByName('All_zhuji').AsString + #13;
mNewValue := mNewValue + CDS_1.FieldByName('PCID').AsString + #13;
mNewValue := mNewValue + CDS_1.FieldByName('GlideID').AsString;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
SQL.Add('UPDATE PCAboutTime SET ');
SQL.Add(mMCName + ' = null WHERE ');
SQL.Add(mMCName + ' = ' + QuotedStr(Trim(mNewValue)));
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
SQL.Add('EXEC P_PC_UpdatePCAboutTime ' + '@MCName = :MCName, ' + '@NewValue = :NewValue, ' + '@StartTime = :StartTime, ' + '@LoopNum = :LoopNum');
Parameters.ParamByName('MCName').Value := mMCName;
Parameters.ParamByName('NewValue').Value := mNewValue;
Parameters.ParamByName('StartTime').Value := mStartTime;
Parameters.ParamByName('LoopNum').Value := mLoopNum;
ExecSQL;
end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
SQL.Add('select * from PCAboutTime ');
SQL.Add(' where time >= ' + quotedStr(Trim(mStartTime)));
Open;
end;
ADOQueryCmd.First;
mNewValue := ADOQueryCmd.FieldByName(mMCName).AsString;
mBegTime := ADOQueryCmd.FieldByName('time').AsString;
mEndTime := ADOQueryCmd.FieldByName('time').AsString;
while not ADOQueryCmd.Eof do
begin
if (ADOQueryCmd.FieldByName(mMCName).AsString = null) or (ADOQueryCmd.FieldByName(mMCName).AsString = '') then
begin
mEndTime := ADOQueryCmd.FieldByName('time').AsString;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('update Dye_Plan_Glide set BegTime = ' + QuotedStr(Trim(mBegTime)));
sql.Add(' , EndTime = ' + QuotedStr(Trim(mEndTime)));
SQL.Add(' where GlideID = ' + QuotedStr(Trim(GetLastLine(mNewValue))));
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
Result := True; // <20><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
Exit;
end;
if mNewValue <> ADOQueryCmd.FieldByName(mMCName).AsString then
begin
mEndTime := ADOQueryCmd.FieldByName('time').AsString;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('update Dye_Plan_Glide set BegTime = ' + QuotedStr(Trim(mBegTime)));
sql.Add(' , EndTime = ' + QuotedStr(Trim(mEndTime)));
SQL.Add(' where GlideID = ' + QuotedStr(Trim(GetLastLine(mNewValue))));
ExecSQL;
end;
mBegTime := ADOQueryCmd.FieldByName('time').AsString;
mNewValue := ADOQueryCmd.FieldByName(mMCName).AsString;
end;
ADOQueryCmd.Next;
end;
end;
ADOQueryCmd.Connection.CommitTrans;
Result := True; // <20><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
except
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
Result := False; // <20><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
end;
end;
function TfrmDyePCDetailsList.GetLastLine(const AText: string): string;
var
StringList: TStringList;
begin
Result := '';
StringList := TStringList.Create;
try
StringList.Text := AText; // <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>س<EFBFBD><D8B3>ָ<EFBFBD>
if StringList.Count > 0 then
Result := StringList[StringList.Count - 1]; // <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
finally
StringList.Free;
end;
end;
procedure TfrmDyePCDetailsList.cxButton1Click(Sender: TObject);
begin
if CDS_2.FieldByName('PC_FLAG').AsString = '1' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_OK);
exit;
end
else if CDS_2.FieldByName('isComplete').AsString <> '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ѱ<EFBFBD><D1B1><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_OK);
exit;
end;
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryMain do
begin
close;
filtered := false;
sql.Clear;
SQL.Add('select Max(EndTime) as MaxTime from V_Dye_Cloth_PaiGang where (BegTime between :StartTime and :EndTime) and PC_FLAG = 1 and MCNO = :MCNO ');
Parameters.ParamByName('StartTime').Value := Trunc(BegDate.Date) + Frac(BegTime.Time);
Parameters.ParamByName('EndTime').Value := Trunc(EndDate.Date) + Frac(EndTime.Time);
Parameters.ParamByName('MCNO').Value := MCNO.Text;
Open;
end;
with CDS_1 do
begin
append;
FieldByName('PCID').value := CDS_2.FieldByName('PCID').AsString;
FieldByName('OrderNo').value := CDS_2.FieldByName('OrderNo').AsString;
FieldByName('GlideName').value := CDS_2.FieldByName('GlideName').AsString;
FieldByName('C_name').value := CDS_2.FieldByName('C_name').AsString;
FieldByName('ALL_temperature6').value := CDS_2.FieldByName('ALL_temperature6').AsString;
FieldByName('time').value := CDS_2.FieldByName('time').AsString;
FieldByName('GlideID').value := CDS_2.FieldByName('GlideID').AsString;
FieldByName('PSType').value := CDS_2.FieldByName('PSType').AsString;
FieldByName('C_Width').value := CDS_2.FieldByName('C_Width').AsString;
FieldByName('All_Speed').value := CDS_2.FieldByName('All_Speed').AsString;
FieldByName('All_zhuji').value := CDS_2.FieldByName('All_zhuji').AsString;
FieldByName('gj_number').AsString := CDS_2.FieldByName('gj_number').AsString;
FieldByName('fp_gjNumber').AsString := CDS_2.FieldByName('fp_gjNumber').AsString;
FieldByName('PCQty').AsString := CDS_2.FieldByName('PCQty').AsString;
FieldByName('begTime').value := ADOQueryMain.FieldByName('MaxTime').AsString;
Post;
end;
ADOQueryCmd.Connection.CommitTrans;
except
if ADOQueryCmd.Connection.InTransaction then
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
// showMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
end;
if SaveData() then
begin
Application.MessageBox('<27>Ų<EFBFBD><C5B2>ɹ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ<EFBFBD><CFA2>', MB_OK);
end;
initGrid1();
end;
procedure TfrmDyePCDetailsList.cxButton2Click(Sender: TObject);
begin
if MessageDlg(<><C8B7>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', mtWarning, [mbOK, mbCancel], 0) = mrOK then
begin
// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
ADOQueryCmd.Connection.BeginTrans;
try
// <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD><C2B2><EFBFBD>
with ADOQueryCmd do
begin
Close;
SQL.Clear;
SQL.Add('UPDATE PCAboutTime SET ');
SQL.Add(MCName.Text + ' = null WHERE ');
SQL.Add(' time >= ' + QuotedStr(CDS_1.FieldByName('BegTime').AsString));
SQL.Add(' and time < ' + QuotedStr(CDS_1.FieldByName('EndTime').AsString));
showMessage(sql.Text);
ExecSQL;
end;
// <20>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD><C2B2><EFBFBD>
with ADOQueryCmd do
begin
Close;
SQL.Clear;
SQL.Add(' update Dye_Plan_Glide set PC_FLAG = 0,endTime = null,begTime = null where GlideID = ' + QuotedStr(Trim(CDS_1.FieldByName('GlideID').asString)));
ExecSQL;
end;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><E1BDBB><EFBFBD><EFBFBD>
ADOQueryCmd.Connection.CommitTrans;
Application.MessageBox(<><C8A1><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
InitGrid1();
except
on E: Exception do
begin
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3><EFBFBD>ع<EFBFBD><D8B9><EFBFBD><EFBFBD><EFBFBD>
ADOQueryCmd.Connection.RollbackTrans;
ShowMessage('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>' + E.Message);
end;
end;
end;
end;
procedure TfrmDyePCDetailsList.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
Action := caFree;
end;
procedure TfrmDyePCDetailsList.FormCreate(Sender: TObject);
begin
inherited;
// EndDate.DateTime := SGetServerDateTime(ADOQueryTemp);
// BegDate.DateTime := EndDate.DateTime;
fsyrName := trim(DdataBase);
canshu1 := trim(DParameters1);
// SInitComBoxBySql(ADOQueryTemp, GlideName, false, 'select PSName as Name from Dye_Process');
end;
procedure TfrmDyePCDetailsList.InitGrid1();
var
mBegDate, mendDate: string;
mAction: string;
rs: _Recordset;
r: integer;
begin
// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
try
tv1.BeginUpdate;
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
close;
filtered := false;
sql.Clear;
SQL.Add('select * from V_Dye_Cloth_PaiGang where (BegTime between :StartTime and :EndTime) and PC_FLAG = 1 and MCNO = :MCNO order By BegTime ');
Parameters.ParamByName('StartTime').Value := Trunc(BegDate.Date) + Frac(BegTime.Time);
Parameters.ParamByName('EndTime').Value := Trunc(EndDate.Date) + Frac(EndTime.Time);
Parameters.ParamByName('MCNO').Value := MCNO.Text;
Open;
end;
SCreateCDS(ADOQueryMain, CDS_1);
SInitCDSData(ADOQueryMain, CDS_1);
finally
ADOQueryMain.EnableControls;
tv1.EndUpdate;
// tv1.ApplyBestFit();
end;
end;
procedure TfrmDyePCDetailsList.InitGrid2();
var
mBegDate, mendDate: string;
mAction: string;
rs: _Recordset;
r: integer;
begin
// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
try
tv1.BeginUpdate;
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
close;
filtered := false;
sql.Clear;
SQL.Add('select * from V_Dye_Cloth_PaiGang');
Open;
end;
SCreateCDS(ADOQueryMain, CDS_2);
SInitCDSData(ADOQueryMain, CDS_2);
finally
ADOQueryMain.EnableControls;
tv1.EndUpdate;
// tv1.ApplyBestFit();
end;
end;
procedure TfrmDyePCDetailsList.MCNOPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmBS_MachineSel := TfrmBS_MachineSel.Create(Application);
with frmBS_MachineSel do
begin
if ShowModal = 1 then
begin
MCNO.Text := frmBS_MachineSel.Order_Main.FieldByName('MCNO').Value;
MCName.Text := frmBS_MachineSel.Order_Main.FieldByName('MCName').Value;
Self.InitGrid1();
end;
end;
finally
frmBS_MachineSel.Free;
end;
end;
procedure TfrmDyePCDetailsList.TBRafreshClick(Sender: TObject);
begin
MovePanel2.Visible := True;
MovePanel2.Refresh;
InitGrid1();
InitGrid2();
MovePanel2.Visible := False;
end;
procedure TfrmDyePCDetailsList.TbUpdateTimeClick(Sender: TObject);
var
DeletedCount, InsertedCount: Integer;
Status, StartDate, EndDate: string;
begin
with ADOQueryTemp do
begin
Close;
SQL.Clear;
sql.Add('exec P_InsertDelTimeToPC @MinuteInterval = 10');
Open;
if not IsEmpty then
begin
Status := FieldByName('״̬').AsString;
DeletedCount := FieldByName(<><C9BE><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>').AsInteger;
InsertedCount := FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>').AsInteger;
StartDate := FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼʱ<CABC><CAB1>').AsString;
EndDate := FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>').AsString;
ShowMessage(Format(<><CAB1><EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD><DDB8>³ɹ<C2B3><C9B9><EFBFBD>' + #13#10 + <><C9BE><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>%d <20><>' + #13#10 + '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>%d <20><>' + #13#10 + <>Χ<E4B7B6><CEA7>%s <20><> %s', [DeletedCount, InsertedCount, StartDate, EndDate]));
end
else
begin
ShowMessage(<><CAB1><EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD><DDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>');
end;
Close;
end;
end;
procedure TfrmDyePCDetailsList.ToolButton1Click(Sender: TObject);
begin
WriteCxGrid(self.Caption + tv1.Name, Tv1, '<27>Ų<EFBFBD><C5B2><EFBFBD>Ϣ');
end;
procedure TfrmDyePCDetailsList.ToolButton2Click(Sender: TObject);
begin
// if ADOQuerymain.IsEmpty then
// exit;
frmMachTaskList := TfrmMachTaskList.create(self);
with frmMachTaskList do
begin
// fcurMachId := trim(self.adoquerymain.FieldByName('mcid').AsString);
// machName.text := trim(self.adoquerymain.FieldByName('mcName').AsString);
showModal;
free;
end;
initgrid1();
end;
procedure TfrmDyePCDetailsList.Tv1BegTimePropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
var
Begtime: TDateTime;
Hour, Min, Sec, MSec: Word;
begin
try
// ʹ<><CAB9> DisplayValue <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Sender.AsString
if VarIsNull(DisplayValue) or (DisplayValue = '') then
Exit;
Begtime := VarToDateTime(DisplayValue);
DecodeTime(Begtime, Hour, Min, Sec, MSec);
if Sec <> 0 then
begin
ErrorText := '<27><>ʼʱ<CABC><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ 0<><30>';
Error := True; // <20><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD>־
end
else if (Min mod 10) <> 0 then // <20><><EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD>֤
begin
ErrorText := '<27><>ʼʱ<CABC><CAB1><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD><D3B1><EFBFBD>Ϊ 10 <20>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>' + IntToStr(Min);
Error := True;
end
else
begin
Error := False; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
end;
except
on E: Exception do
begin
ErrorText := <><CAB1><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + E.Message;
Error := True;
end;
end;
end;
procedure TfrmDyePCDetailsList.tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
// if ADOQuerymain.IsEmpty then
// exit;
frmMachTaskList := TfrmMachTaskList.create(self);
with frmMachTaskList do
begin
fBegTime := Self.CDS_1.FieldByName('time').AsString;
fMCName := Self.Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
fText := self.CDS_1.FieldByName(fMCName).AsString;
showModal;
free;
end;
initgrid1();
end;
procedure TfrmDyePCDetailsList.tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
begin
inherited;
ACanvas.Font.Size := 7;
end;
procedure TfrmDyePCDetailsList.Tv1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
case Key of
VK_LEFT:
begin
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
// ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6>Ĵ<EFBFBD><C4B4><EFBFBD>
end;
VK_RIGHT:
begin
// <20>ҷ<EFBFBD><D2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ShowMessage('<27>ҷ<EFBFBD><D2B7><EFBFBD><EFBFBD><EFBFBD>');
// ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6>Ĵ<EFBFBD><C4B4><EFBFBD>
end;
VK_UP:
begin
// <20>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ShowMessage('<27>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD>');
// ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6>Ĵ<EFBFBD><C4B4><EFBFBD>
end;
VK_DOWN:
begin
// <20>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ShowMessage('<27>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>');
// ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6>Ĵ<EFBFBD><C4B4><EFBFBD>
end;
end;
end;
procedure TfrmDyePCDetailsList.Tv2CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
PC_FLAG, isComplete: Variant;
begin
// <20><>ȡ<EFBFBD>ֶ<EFBFBD>ֵ
PC_FLAG := AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('PC_FLAG').Index];
isComplete := AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('isComplete').Index];
// <20><><EFBFBD>ò<EFBFBD>ͬ״̬<D7B4><CCAC><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if VarIsNull(PC_FLAG) or (PC_FLAG = 0) then // δ<><CEB4><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>
begin
ACanvas.Brush.Color := $00CCCCFF; // dz<><C7B3>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
ACanvas.Font.Color := clRed;
ACanvas.Font.Style := [fsBold];
end
else if (PC_FLAG = 1) and VarIsNull(isComplete) then // <20><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>
begin
ACanvas.Brush.Color := clWindow; // Ĭ<>ϴ<EFBFBD><CFB4>ڱ<EFBFBD><DAB1><EFBFBD>ɫ
ACanvas.Font.Color := clWindowText; // Ĭ<>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ı<EFBFBD>ɫ
ACanvas.Font.Style := [];
end
else if (not VarIsNull(isComplete)) and (isComplete = 0) then // <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
begin
ACanvas.Brush.Color := $00E0E0E0; // dz<><C7B3>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
ACanvas.Font.Color := clGray;
ACanvas.Font.Style := [fsBold]; //
end
else if (not VarIsNull(isComplete)) and (isComplete = 1) then // <20><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
begin
ACanvas.Brush.Color := $00E0FFE0; // dz<><C7B3>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
ACanvas.Font.Color := $00008000;
ACanvas.Font.Style := [fsBold];
end
else // Ĭ<><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
begin
ACanvas.Brush.Color := clWindow;
ACanvas.Font.Color := clWindowText;
ACanvas.Font.Style := [];
end;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
// ADone := True;
end;
procedure TfrmDyePCDetailsList.Tv2KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
case Key of
VK_LEFT:
begin
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
// ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6>Ĵ<EFBFBD><C4B4><EFBFBD>
end;
VK_RIGHT:
begin
// <20>ҷ<EFBFBD><D2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ShowMessage('<27>ҷ<EFBFBD><D2B7><EFBFBD><EFBFBD><EFBFBD>');
// ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6>Ĵ<EFBFBD><C4B4><EFBFBD>
end;
VK_UP:
begin
// <20>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ShowMessage('<27>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD>');
// ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6>Ĵ<EFBFBD><C4B4><EFBFBD>
end;
VK_DOWN:
begin
// <20>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ShowMessage('<27>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>');
// ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6>Ĵ<EFBFBD><C4B4><EFBFBD>
end;
end;
end;
procedure TfrmDyePCDetailsList.ConNoMChange(Sender: TObject);
begin
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
end;
end;
procedure TfrmDyePCDetailsList.TBCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmDyePCDetailsList.FormShow(Sender: TObject);
begin
inherited;
ReadCxGrid(self.Caption + tv1.Name, Tv1, '<27>Ų<EFBFBD><C5B2><EFBFBD>Ϣ<EFBFBD><CFA2>ϸ');
ReadCxGrid(self.Caption + tv2.Name, Tv2, '<27>Ų<EFBFBD><C5B2><EFBFBD>Ϣ<EFBFBD><CFA2>ϸ');
canshu1 := self.fParameters1;
// BegDate.DateTime := strToDateTime(FormatDateTime('yyyy-MM-dd 00:00:00', SGetServerDate(ADOQueryTemp))) - 1;
// EndDate.DateTime := strToDateTime(FormatDateTime('yyyy-MM-dd 00:00:00', SGetServerDate(ADOQueryTemp))) + 1;
var ServerDate: TDateTime := SGetServerDate(ADOQueryTemp);
BegDate.Date := Trunc(ServerDate) - 1; // ǰһ<C7B0><D2BB>
EndDate.Date := Trunc(ServerDate) + 1; // <20><>һ<EFBFBD><D2BB>
Begtime.Time := EncodeTime(0, 0, 0, 0); // <20><><EFBFBD><EFBFBD>8<EFBFBD><38>
endTime.Time := EncodeTime(0, 0, 0, 0); // <20><><EFBFBD><EFBFBD>6<EFBFBD><36>
initgrid1();
initgrid2();
KeyPreview := True;
end;
procedure TfrmDyePCDetailsList.TBExportClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then
exit;
TcxGridToExcel(self.Caption, cxGrid1);
end;
procedure TfrmDyePCDetailsList.TBFindClick(Sender: TObject);
begin
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS(ADOQueryMain, CDS_1);
SInitCDSData(ADOQueryMain, CDS_1);
end;
end;
procedure TfrmDyePCDetailsList.TbMoveDownClick(Sender: TObject);
begin
if SaveMove('<27><><EFBFBD><EFBFBD>') then
ShowMessage('<27><><EFBFBD>Ƴɹ<C6B3><C9B9><EFBFBD>')
else
ShowMessage('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
end;
procedure TfrmDyePCDetailsList.TbMoveUpClick(Sender: TObject);
begin
if SaveMove('<27><><EFBFBD><EFBFBD>') then
ShowMessage('<27><><EFBFBD>Ƴɹ<C6B3><C9B9><EFBFBD>')
else
ShowMessage('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
end;
procedure TfrmDyePCDetailsList.pcidChange(Sender: TObject);
begin
TBFind.Click;
end;
procedure TfrmDyePCDetailsList.PRTColorChange(Sender: TObject);
begin
TBFind.Click;
end;
procedure TfrmDyePCDetailsList.TBdelClick(Sender: TObject);
begin
if CDS_1.IsEmpty then
Exit;
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
try
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('insert into Dye_Need_Up(UType,UDataId) values(''<27><>̨ˢ<CCA8><CBA2>'',' + quotedstr(Trim(CDS_1.fieldbyname('GOID').AsString)) + ') ');
sql.Add('delete Dye_Plan_Glide_OutPut where GOID=''' + Trim(CDS_1.fieldbyname('GOID').AsString) + '''');
ExecSQL;
end;
////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_Dye_Card_upCL @PCID=' + QuotedStr(CDS_1.fieldbyname('pcid').AsString));
execsql;
end;
////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
CDS_1.Delete;
except
application.MessageBox(<><C9BE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
end.