D10sxYilanbuyi/F04染色刷卡/U_DyePCDetailsList.pas
2025-12-09 17:30:34 +08:00

1848 lines
55 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, Vcl.Buttons;
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;
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;
Tv1GlideID: TcxGridDBColumn;
Tv2GlideID: TcxGridDBColumn;
Tv1IsConflict: TcxGridDBColumn;
Tv1CGlideNo: TcxGridDBColumn;
Tv2GlideNo: TcxGridDBColumn;
Panel3: TPanel;
cxButton1: TcxButton;
cxButton2: TcxButton;
TbMoveUp: TcxButton;
TbMoveDown: TcxButton;
cbALL_temperature6: TCheckBox;
cbAll_zhuji: TCheckBox;
cxComboBox1: TcxComboBox;
Label5: TLabel;
Label6: TLabel;
cbTime: TCheckBox;
Tv1All_zhuji: TcxGridDBColumn;
Tv1All_rate: TcxGridDBColumn;
Tv2CAll_zhuji: TcxGridDBColumn;
Tv2All_rate: TcxGridDBColumn;
TbEdit: TToolButton;
Label8: TLabel;
C_Name: TEdit;
Label9: TLabel;
OrderNo: TEdit;
SBCCQX1: TSpeedButton;
SBDX3: TSpeedButton;
SBDX2: TSpeedButton;
SBDX1: TSpeedButton;
SBJG1: TSpeedButton;
SBDX6: TSpeedButton;
SBDX5: TSpeedButton;
SBDX4: TSpeedButton;
SBJRG1: TSpeedButton;
SBJRG3: TSpeedButton;
SBZM1: TSpeedButton;
SBJRG2: TSpeedButton;
SBZM2: TSpeedButton;
SBCCQX2: TSpeedButton;
SBPD1: TSpeedButton;
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 PRTColorChange(Sender: TObject);
procedure TBdelClick(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
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);
procedure Tv2CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
procedure cxComboBox1PropertiesChange(Sender: TObject);
procedure cbALL_temperature6Click(Sender: TObject);
procedure TbEditClick(Sender: TObject);
procedure pcidKeyPress(Sender: TObject; var Key: Char);
procedure SBCCQX1Click(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;
function GetNextTenMinutes(ACurrentTime: TDateTime): TDateTime;
function BuildOrderBySQL: string;
{ Private declarations }
public
fsyrName, canshu1: string;
fsql2: string;
{ Public declarations }
end;
var
frmDyePCDetailsList: TfrmDyePCDetailsList;
OrderList: array of string;
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;
VK_LEFT:
begin
// <20><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD>߼<EFBFBD>
ShowMessage('<27><>');
cxButton1.Click;
Key := 0; // <20><>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
end;
VK_RIGHT:
begin
// <20><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD>߼<EFBFBD>
cxButton2.Click;
Key := 0;
end;
VK_UP:
begin
// <20><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD>߼<EFBFBD>
TbMoveUp.Click;
Key := 0;
end;
VK_DOWN:
begin
// <20><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD>߼<EFBFBD>
TbMoveDown.Click;
Key := 0;
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 + ' ' + CDS_1.FieldByName('All_rate').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 + ' ' + CDS_1.FieldByName('All_rate').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;
procedure TfrmDyePCDetailsList.SBCCQX1Click(Sender: TObject);
begin
if Sender is TSpeedButton then
begin
case (Sender as TSpeedButton).Tag of // <20><>Tag<61><67><EFBFBD>ֲ<EFBFBD>ͬ<EFBFBD><CDAC>ť
1:
begin
MCNO.Text := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4>1';
MCName.Text := 'CCQX1';
InitGrid1();
end;
2:
begin
MCNO.Text := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4>2';
MCName.Text := 'CCQX2';
InitGrid1();
end;
3:
begin
MCNO.Text := '<27><><EFBFBD>ͻ<EFBFBD>1';
MCName.Text := 'DX1';
InitGrid1();
end;
4:
begin
MCNO.Text := '<27><><EFBFBD>ͻ<EFBFBD>2';
MCName.Text := 'DX2';
InitGrid1();
end;
5:
begin
MCNO.Text := '<27><><EFBFBD>ͻ<EFBFBD>3';
MCName.Text := 'DX3';
InitGrid1();
end;
6:
begin
MCNO.Text := '<27><><EFBFBD>ͻ<EFBFBD>4';
MCName.Text := 'DX4';
InitGrid1();
end;
7:
begin
MCNO.Text := '<27><><EFBFBD>ͻ<EFBFBD>5';
MCName.Text := 'DX5';
InitGrid1();
end;
8:
begin
MCNO.Text := '<27><><EFBFBD>ͻ<EFBFBD>6';
MCName.Text := 'DX6';
InitGrid1();
end;
9:
begin
MCNO.Text := '<27><><EFBFBD><EFBFBD>1';
MCName.Text := 'JG1';
InitGrid1();
end;
10:
begin
MCNO.Text := '<27><>Ⱦ<EFBFBD><C8BE>1';
MCName.Text := 'JRG1';
InitGrid1();
end;
11:
begin
MCNO.Text := '<27><>Ⱦ<EFBFBD><C8BE>2';
MCName.Text := 'JRG2';
InitGrid1();
end;
12:
begin
MCNO.Text := '<27><>Ⱦ<EFBFBD><C8BE>3';
MCName.Text := 'JRG3';
InitGrid1();
end;
13:
begin
MCNO.Text := '<27><>ë<EFBFBD><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1';
MCName.Text := 'ZM1';
InitGrid1();
end;
14:
begin
MCNO.Text := '<27><>ë˫<C3AB><CBAB><EFBFBD><EFBFBD>1';
MCName.Text := 'ZM2';
InitGrid1();
end;
15:
begin
MCNO.Text := '<27>Ĵ<EFBFBD><C4B4><EFBFBD>1';
MCName.Text := 'PD1';
InitGrid1();
end;
end;
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;
function TfrmDyePCDetailsList.GetNextTenMinutes(ACurrentTime: TDateTime): TDateTime;
begin
// <20><><EFBFBD><EFBFBD><E3B5BD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ʮ<EFBFBD><CAAE><EFBFBD><EFBFBD>
Result := Trunc(ACurrentTime * 24 * 6) / (24 * 6); // ȡ<><C8A1><EFBFBD><EFBFBD>10<31><30><EFBFBD><EFBFBD>
if Result <= ACurrentTime then
Result := Result + (10 / (24 * 60)); // <20><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>С<EFBFBD>ڵ<EFBFBD><DAB5>ڵ<EFBFBD>ǰʱ<C7B0><EFBFBD><E4A3AC>10<31><30><EFBFBD><EFBFBD>
end;
procedure TfrmDyePCDetailsList.cxButton1Click(Sender: TObject);
var
MaxEndTime: TDateTime;
mGlideID1, mGlideID2: string;
mConflict1, mConflict2: Integer;
begin
mConflict1 := 0;
mConflict2 := 0;
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 not CDS_2.FieldByName('isComplete').IsNull then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ѱ<EFBFBD><D1B1><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_OK);
exit;
end;
if (CDS_2.FieldByName('time').AsString = '0') or (CDS_2.FieldByName('time').IsNull) then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><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;
if (ADOQueryMain.RecordCount > 0) and (not ADOQueryMain.FieldByName('MaxTime').IsNull) then
MaxEndTime := ADOQueryMain.FieldByName('MaxTime').AsDateTime
else
MaxEndTime := GetNextTenMinutes(Now); // ʹ<><CAB9><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ʮ<EFBFBD><CAAE><EFBFBD><EFBFBD>
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('GlideNo').value := CDS_2.FieldByName('GlideNo').AsString;
FieldByName('All_zhuji').value := CDS_2.FieldByName('All_zhuji').AsString;
FieldByName('All_rate').value := CDS_2.FieldByName('All_rate').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 := MaxEndTime;
Post;
end;
//////////////<2F>Ų<EFBFBD>˳<EFBFBD><CBB3>ʱ<EFBFBD><CAB1>////////
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add(' select * from Dye_Plan_Glide where PCID = ' + QuotedStr(Trim(CDS_2.FieldByName('PCID').AsString)));
SQL.Add(' and PC_FLAG = 1 and endTime > ' + quotedStr(FormatDateTime('yyyy-mm-dd hh:nn:ss', MaxEndTime)));
SQL.Add(' and GlideNo < ' + QuotedStr(Trim(CDS_2.FieldByName('GlideNo').AsString)));
// ShowMessage(sql.Text);
open;
if not IsEmpty then
begin
if Application.MessageBox('<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>γ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_OKCANCEL + MB_ICONQUESTION) = IDOK then
begin
mConflict1 := 1;
end
else
begin
ADOQueryCmd.Connection.RollbackTrans;
InitGrid1();
Exit;
end;
end;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add(' select * from Dye_Plan_Glide where PCID = ' + QuotedStr(Trim(CDS_2.FieldByName('PCID').AsString)));
SQL.Add(' and PC_FLAG = 1 and BegTime < DATEADD(MINUTE, ' + CDS_2.FieldByName('time').AsString + ', ' + QuotedStr(FormatDateTime('yyyy-mm-dd hh:nn:ss', MaxEndTime)) + ')');
SQL.Add(' and GlideNo > ' + QuotedStr(Trim(CDS_2.FieldByName('GlideNo').AsString)));
// ShowMessage(sql.Text);
open;
if not IsEmpty then
begin
if Application.MessageBox('<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>γ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_OKCANCEL + MB_ICONQUESTION) = IDOK then
begin
mConflict2 := 1;
end
else
begin
// <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><><C8A1>"<22><><EFBFBD>˳<EFBFBD>
ADOQueryCmd.Connection.RollbackTrans;
InitGrid1();
Exit;
end;
end;
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
if mConflict1 = 1 then
begin
with ADOQueryCmd do
begin
Close;
SQL.Clear;
SQL.Add('UPDATE Dye_Plan_Glide SET IsConflict = 1');
SQL.Add('WHERE PCID = ' + QuotedStr(Trim(CDS_2.FieldByName('PCID').AsString)));
SQL.Add('AND PC_FLAG = 1 AND endTime > ' + QuotedStr(FormatDateTime('yyyy-mm-dd hh:nn:ss', MaxEndTime)));
SQL.Add('AND GlideNo <= ' + QuotedStr(Trim(CDS_2.FieldByName('GlideNo').AsString)));
ExecSQL;
end;
end;
if mConflict2 = 1 then
begin
with ADOQueryCmd do
begin
Close;
SQL.Clear;
SQL.Add('UPDATE Dye_Plan_Glide SET IsConflict = 1');
SQL.Add('WHERE PCID = ' + QuotedStr(Trim(CDS_2.FieldByName('PCID').AsString)));
SQL.Add('AND PC_FLAG = 1 AND BegTime < DATEADD(MINUTE, ' + CDS_2.FieldByName('time').AsString + ', ' + QuotedStr(FormatDateTime('yyyy-mm-dd hh:nn:ss', MaxEndTime)) + ')');
SQL.Add('AND GlideNo >= ' + QuotedStr(Trim(CDS_2.FieldByName('GlideNo').AsString)));
ExecSQL;
end;
end;
Application.MessageBox('<27>Ų<EFBFBD><C5B2>ɹ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ<EFBFBD><CFA2>', MB_OK);
end;
if not CDS_1.IsEmpty then
mGlideID1 := Trim(CDS_1.FieldByName('GlideID').AsString)
else
mGlideID1 := '';
if not CDS_2.IsEmpty then
mGlideID2 := Trim(CDS_2.FieldByName('GlideID').AsString)
else
mGlideID2 := '';
initGrid1();
initGrid2();
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>λ<EFBFBD><CEBB>ԭ<EFBFBD><D4AD>¼
if mGlideID1 <> '' then
CDS_1.Locate('GlideID', mGlideID1, []);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>λ<EFBFBD><CEBB>ԭ<EFBFBD><D4AD>¼
if mGlideID2 <> '' then
CDS_2.Locate('GlideID', mGlideID2, []);
end;
procedure TfrmDyePCDetailsList.cxButton2Click(Sender: TObject);
var
mGlideID1, mGlideID2: string;
mConflict: Integer;
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
mConflict := 0;
// <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,IsConflict = 0,endTime = null,begTime = null where GlideID = ' + QuotedStr(Trim(CDS_1.FieldByName('GlideID').asString)));
ExecSQL;
end;
/////////////////////////////<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ͻ/////////////////////
with ADOQueryBaseCmd do
begin
Close;
sql.Clear;
sql.Add(' select * from Dye_Plan_Glide where PCID = ' + QuotedStr(Trim(CDS_1.FieldByName('PCID').AsString)));
sql.Add(' and PC_FLAG = 1');
Open;
end;
ADOQueryBaseCmd.First;
while not ADOQueryBaseCmd.Eof do
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add(' select * from Dye_Plan_Glide where PCID = ' + QuotedStr(Trim(CDS_1.FieldByName('PCID').AsString)));
SQL.Add(' and PC_FLAG = 1 and endTime > ' + quotedStr(ADOQueryBaseCmd.FieldByName('BegTime').AsString));
SQL.Add(' and GlideNo < ' + QuotedStr(Trim(ADOQueryBaseCmd.FieldByName('GlideNo').AsString)));
// ShowMessage(sql.Text);
open;
if not IsEmpty then
begin
mConflict := 1;
end;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add(' select * from Dye_Plan_Glide where PCID = ' + QuotedStr(Trim(CDS_1.FieldByName('PCID').AsString)));
SQL.Add(' and PC_FLAG = 1 and BegTime < ' + quotedStr(ADOQueryBaseCmd.FieldByName('EndTime').AsString));
SQL.Add(' and GlideNo > ' + QuotedStr(Trim(ADOQueryBaseCmd.FieldByName('GlideNo').AsString)));
// ShowMessage(sql.Text);
open;
if not IsEmpty then
begin
mConflict := 1;
end;
end;
if mConflict = 0 then
begin
ADOQueryBaseCmd.Edit;
ADOQueryBaseCmd.FieldByName('IsConflict').Value := 0;
ADOQueryBaseCmd.Post;
end;
/////////////////////////////////////////////
ADOQueryBaseCmd.Next;
end;
//////////////<2F>Ų<EFBFBD>˳<EFBFBD><CBB3>ʱ<EFBFBD><CAB1>////////
// <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);
if not CDS_1.IsEmpty then
mGlideID1 := Trim(CDS_1.FieldByName('GlideID').AsString)
else
mGlideID1 := '';
if not CDS_2.IsEmpty then
mGlideID2 := Trim(CDS_2.FieldByName('GlideID').AsString)
else
mGlideID2 := '';
initGrid1();
initGrid2();
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>λ<EFBFBD><CEBB>ԭ<EFBFBD><D4AD>¼
if mGlideID1 <> '' then
CDS_1.Locate('GlideID', mGlideID1, []);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>λ<EFBFBD><CEBB>ԭ<EFBFBD><D4AD>¼
if mGlideID2 <> '' then
CDS_2.Locate('GlideID', mGlideID2, []);
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.cxComboBox1PropertiesChange(Sender: TObject);
begin
InitGrid2();
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 MCName = :MCName 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('MCName').Value := MCName.Text;
// ShowMessage(sql.Text);
Open;
end;
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
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;
msql1: string;
begin
// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
try
tv1.BeginUpdate;
ADOQueryMain.DisableControls;
if cxComboBox1.Text = <>Ų<EFBFBD>' then
msql1 := 'and PC_FLAG = 0'
else if cxComboBox1.Text = '<27>Ų<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>' then
msql1 := 'and isComplete is null and PC_FLAG = 1'
else if cxComboBox1.Text = '<27>ѱ<EFBFBD><D1B1><EFBFBD>' then
msql1 := 'and isComplete is not null'
else if cxComboBox1.Text = '<27><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>' then
msql1 := 'and isComplete = 0'
else if cxComboBox1.Text = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
msql1 := 'and isComplete = 1'
else
msql1 := '';
fsql2 := BuildOrderBySQL;
with ADOQueryMain do
begin
close;
filtered := false;
sql.Clear;
SQL.Add(' select * from V_Dye_Cloth_PaiGang where 1=1 ' + msql1 + fsql2);
// ShowMessage(sql.Text);
Open;
end;
SCreateCDS(ADOQueryMain, CDS_2);
SInitCDSData(ADOQueryMain, CDS_2);
finally
ADOQueryMain.EnableControls;
tv1.EndUpdate;
// tv1.ApplyBestFit();
end;
end;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
procedure TfrmDyePCDetailsList.cbALL_temperature6Click(Sender: TObject);
var
CheckBox: TCheckBox;
FieldName, OrderText: string;
I, Index: Integer;
begin
CheckBox := Sender as TCheckBox;
if CheckBox = cbALL_temperature6 then
FieldName := 'ALL_temperature6'
else if CheckBox = cbAll_zhuji then
FieldName := 'All_zhuji'
else if CheckBox = cbTime then
FieldName := 'Time'
else
Exit;
OrderText := FieldName + ' ASC';
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ѵ<EFBFBD><D1B4><EFBFBD>
Index := -1;
for I := 0 to High(OrderList) do
begin
if OrderList[I] = OrderText then
begin
Index := I;
Break;
end;
end;
if CheckBox.Checked then
begin
// <20><><EFBFBD>ӻ<EFBFBD><D3BB>ƶ<EFBFBD><C6B6><EFBFBD>ĩβ
if Index >= 0 then
begin
// <20>Ѵ<EFBFBD><D1B4>ڣ<EFBFBD><DAA3><EFBFBD>ɾ<EFBFBD><C9BE>
for I := Index to High(OrderList) - 1 do
OrderList[I] := OrderList[I + 1];
SetLength(OrderList, Length(OrderList) - 1);
end;
// <20><><EFBFBD>ӵ<EFBFBD>ĩβ
SetLength(OrderList, Length(OrderList) + 1);
OrderList[High(OrderList)] := OrderText;
end
else
begin
// ȡ<><C8A1>ѡ<EFBFBD>У<EFBFBD><D0A3>Ƴ<EFBFBD>
if Index >= 0 then
begin
for I := Index to High(OrderList) - 1 do
OrderList[I] := OrderList[I + 1];
SetLength(OrderList, Length(OrderList) - 1);
end;
end;
InitGrid2();
end;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C>ʹ<EFBFBD>ö<EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E6B1BE>
function TfrmDyePCDetailsList.BuildOrderBySQL: string;
var
I: Integer;
OrderStr: string;
begin
// <20><><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ѡ<EFBFBD><D1A1><EFBFBD>κ<EFBFBD><CEBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if Length(OrderList) = 0 then
begin
Result := ' order By PCID ASC , GlideNo ASC';
Exit;
end;
// ƴ<><C6B4>SQL
OrderStr := '';
for I := 0 to High(OrderList) do
begin
if I > 0 then
OrderStr := OrderStr + ' , ';
OrderStr := OrderStr + OrderList[I];
end;
Result := ' Order By ' + OrderStr;
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>Ϣ<EFBFBD><CFA2>ϸ');
WriteCxGrid(self.Caption + tv1.Name, Tv1, '<27>Ų<EFBFBD><C5B2><EFBFBD>Ϣ<EFBFBD><CFA2>ϸ');
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.tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
mIsConflict: Variant;
begin
// <20><>ȡ<EFBFBD>ֶ<EFBFBD>ֵ
mIsConflict := AViewInfo.GridRecord.Values[TcxGridDBTableView(Sender).GetColumnByFieldName('IsConflict').Index];
if AViewInfo.GridRecord.Selected then
begin
ADone := False; // <20>ÿؼ<C3BF><D8BC><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>Ĭ<EFBFBD>ϵ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ʽ
Exit;
end;
// <20><><EFBFBD>ò<EFBFBD>ͬ״̬<D7B4><CCAC><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if mIsConflict = 1 then // δ<><CEB4><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>
begin
ACanvas.Brush.Color := clRed; // <20><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
ACanvas.Font.Color := clWindowText;
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.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.Tv2CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
// ShowMessage(CDS_2.FieldByName('isComplete').asString);
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];
if AViewInfo.GridRecord.Selected then
begin
ADone := False; // <20>ÿؼ<C3BF><D8BC><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>Ĭ<EFBFBD>ϵ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ʽ
Exit;
end;
// <20><><EFBFBD>ò<EFBFBD>ͬ״̬<D7B4><CCAC><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (not VarIsNull(isComplete)) and (isComplete = true) 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 if (not VarIsNull(isComplete)) and (isComplete = False) 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 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 // Ĭ<><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
InitGrid1();
if ADOQueryMain.Active then
begin
// ShowMessage(IntToStr(ADOQueryMain.RecordCount));
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
// ShowMessage(IntToStr(ADOQueryMain.RecordCount));
SCreateCDS(ADOQueryMain, CDS_1);
SInitCDSData(ADOQueryMain, CDS_1);
end;
end;
procedure TfrmDyePCDetailsList.TbMoveDownClick(Sender: TObject);
var
mGlideID1, mGlideID2: string;
mConflict: Integer;
begin
if SaveMove('<27><><EFBFBD><EFBFBD>') then
begin
/////////////////////////////<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ͻ/////////////////////
with ADOQueryBaseCmd do
begin
Close;
sql.Clear;
sql.Add(' select * from Dye_Plan_Glide where PCID = ' + QuotedStr(Trim(CDS_1.FieldByName('PCID').AsString)));
sql.Add(' and PC_FLAG = 1');
Open;
end;
ADOQueryBaseCmd.First;
while not ADOQueryBaseCmd.Eof do
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add(' select * from Dye_Plan_Glide where PCID = ' + QuotedStr(Trim(CDS_1.FieldByName('PCID').AsString)));
SQL.Add(' and PC_FLAG = 1 and endTime > ' + quotedStr(ADOQueryBaseCmd.FieldByName('BegTime').AsString));
SQL.Add(' and GlideNo < ' + QuotedStr(Trim(ADOQueryBaseCmd.FieldByName('GlideNo').AsString)));
// ShowMessage(sql.Text);
open;
if not IsEmpty then
begin
mConflict := 1;
end;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add(' select * from Dye_Plan_Glide where PCID = ' + QuotedStr(Trim(CDS_1.FieldByName('PCID').AsString)));
SQL.Add(' and PC_FLAG = 1 and BegTime < ' + quotedStr(ADOQueryBaseCmd.FieldByName('EndTime').AsString));
SQL.Add(' and GlideNo > ' + QuotedStr(Trim(ADOQueryBaseCmd.FieldByName('GlideNo').AsString)));
// ShowMessage(sql.Text);
open;
if not IsEmpty then
begin
mConflict := 1;
end;
end;
if mConflict = 0 then
begin
ADOQueryBaseCmd.Edit;
ADOQueryBaseCmd.FieldByName('IsConflict').Value := 0;
ADOQueryBaseCmd.Post;
end
else
begin
ADOQueryBaseCmd.Edit;
ADOQueryBaseCmd.FieldByName('IsConflict').Value := 1;
ADOQueryBaseCmd.Post;
end;
/////////////////////////////////////////////
ADOQueryBaseCmd.Next;
end;
if not CDS_1.IsEmpty then
mGlideID1 := Trim(CDS_1.FieldByName('GlideID').AsString)
else
mGlideID1 := '';
if not CDS_2.IsEmpty then
mGlideID2 := Trim(CDS_2.FieldByName('GlideID').AsString)
else
mGlideID2 := '';
initGrid1();
initGrid2();
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>λ<EFBFBD><CEBB>ԭ<EFBFBD><D4AD>¼
if mGlideID1 <> '' then
CDS_1.Locate('GlideID', mGlideID1, []);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>λ<EFBFBD><CEBB>ԭ<EFBFBD><D4AD>¼
if mGlideID2 <> '' then
CDS_2.Locate('GlideID', mGlideID2, []);
ShowMessage('<27><><EFBFBD>Ƴɹ<C6B3><C9B9><EFBFBD>');
end
else
ShowMessage('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
end;
procedure TfrmDyePCDetailsList.TbMoveUpClick(Sender: TObject);
var
mGlideID1, mGlideID2: string;
mConflict: Integer;
begin
if SaveMove('<27><><EFBFBD><EFBFBD>') then
begin
/////////////////////////////<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ͻ/////////////////////
with ADOQueryBaseCmd do
begin
Close;
sql.Clear;
sql.Add(' select * from Dye_Plan_Glide where PCID = ' + QuotedStr(Trim(CDS_1.FieldByName('PCID').AsString)));
sql.Add(' and PC_FLAG = 1');
Open;
end;
ADOQueryBaseCmd.First;
while not ADOQueryBaseCmd.Eof do
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add(' select * from Dye_Plan_Glide where PCID = ' + QuotedStr(Trim(CDS_1.FieldByName('PCID').AsString)));
SQL.Add(' and PC_FLAG = 1 and endTime > ' + quotedStr(ADOQueryBaseCmd.FieldByName('BegTime').AsString));
SQL.Add(' and GlideNo < ' + QuotedStr(Trim(ADOQueryBaseCmd.FieldByName('GlideNo').AsString)));
// ShowMessage(sql.Text);
open;
if not IsEmpty then
begin
mConflict := 1;
end;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add(' select * from Dye_Plan_Glide where PCID = ' + QuotedStr(Trim(CDS_1.FieldByName('PCID').AsString)));
SQL.Add(' and PC_FLAG = 1 and BegTime < ' + quotedStr(ADOQueryBaseCmd.FieldByName('EndTime').AsString));
SQL.Add(' and GlideNo > ' + QuotedStr(Trim(ADOQueryBaseCmd.FieldByName('GlideNo').AsString)));
// ShowMessage(sql.Text);
open;
if not IsEmpty then
begin
mConflict := 1;
end;
end;
if mConflict = 0 then
begin
ADOQueryBaseCmd.Edit;
ADOQueryBaseCmd.FieldByName('IsConflict').Value := 0;
ADOQueryBaseCmd.Post;
end
else
begin
ADOQueryBaseCmd.Edit;
ADOQueryBaseCmd.FieldByName('IsConflict').Value := 1;
ADOQueryBaseCmd.Post;
end;
ADOQueryBaseCmd.Next;
end;
/////////////////////////////////////////////
if not CDS_1.IsEmpty then
mGlideID1 := Trim(CDS_1.FieldByName('GlideID').AsString)
else
mGlideID1 := '';
if not CDS_2.IsEmpty then
mGlideID2 := Trim(CDS_2.FieldByName('GlideID').AsString)
else
mGlideID2 := '';
initGrid1();
initGrid2();
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>λ<EFBFBD><CEBB>ԭ<EFBFBD><D4AD>¼
if mGlideID1 <> '' then
CDS_1.Locate('GlideID', mGlideID1, []);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>λ<EFBFBD><CEBB>ԭ<EFBFBD><D4AD>¼
if mGlideID2 <> '' then
CDS_2.Locate('GlideID', mGlideID2, []);
ShowMessage('<27><><EFBFBD>Ƴɹ<C6B3><C9B9><EFBFBD>');
end
else
ShowMessage('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
end;
procedure TfrmDyePCDetailsList.pcidKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
InitGrid1();
end;
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;
procedure TfrmDyePCDetailsList.TbEditClick(Sender: TObject);
var
mConflict: Integer;
begin
if CDS_1.IsEmpty then
begin
Exit;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.add('select * from PCAboutTime where time = ' + QuotedStr(Trim(CDS_1.FieldByName('begtime').AsString)));
Open;
end;
//
frmMachTaskList := TfrmMachTaskList.create(self);
with frmMachTaskList do
begin
fBegTime := Self.CDS_1.FieldByName('Begtime').AsString;
fMCName := Self.MCName.Text;
fText := self.ADOQueryCmd.FieldByName(fMCName).AsString;
showModal;
free;
end;
/////////////////////////////<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ͻ/////////////////////
with ADOQueryBaseCmd do
begin
Close;
sql.Clear;
sql.Add(' select * from Dye_Plan_Glide where PCID = ' + QuotedStr(Trim(Self.CDS_1.FieldByName('PCID').AsString)));
sql.Add(' and PC_FLAG = 1');
Open;
end;
ADOQueryBaseCmd.First;
while not ADOQueryBaseCmd.Eof do
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add(' select * from Dye_Plan_Glide where PCID = ' + QuotedStr(Trim(Self.CDS_1.FieldByName('PCID').AsString)));
SQL.Add(' and PC_FLAG = 1 and endTime > ' + quotedStr(ADOQueryBaseCmd.FieldByName('BegTime').AsString));
SQL.Add(' and GlideNo < ' + QuotedStr(Trim(ADOQueryBaseCmd.FieldByName('GlideNo').AsString)));
// ShowMessage(sql.Text);
open;
if not IsEmpty then
begin
mConflict := 1;
end;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add(' select * from Dye_Plan_Glide where PCID = ' + QuotedStr(Trim(Self.CDS_1.FieldByName('PCID').AsString)));
SQL.Add(' and PC_FLAG = 1 and BegTime < ' + quotedStr(ADOQueryBaseCmd.FieldByName('EndTime').AsString));
SQL.Add(' and GlideNo > ' + QuotedStr(Trim(ADOQueryBaseCmd.FieldByName('GlideNo').AsString)));
// ShowMessage(sql.Text);
open;
if not IsEmpty then
begin
mConflict := 1;
end;
end;
if mConflict = 0 then
begin
ADOQueryBaseCmd.Edit;
ADOQueryBaseCmd.FieldByName('IsConflict').Value := 0;
ADOQueryBaseCmd.Post;
end
else
begin
ADOQueryBaseCmd.Edit;
ADOQueryBaseCmd.FieldByName('IsConflict').Value := 1;
ADOQueryBaseCmd.Post;
end;
ADOQueryBaseCmd.Next;
end;
initgrid1();
end;
end.