RTFormwork/项目代码/RTBasicsV1/F02染色计划单/U_DyePlanCardList.pas
“ddf” 61630656e9 1
2024-07-07 09:35:27 +08:00

806 lines
21 KiB
ObjectPascal
Raw Permalink 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_DyePlanCardList;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView, cxGridTableView,
cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, cxMemo,
cxRichEdit, ComCtrls, cxContainer, cxTextEdit, cxMaskEdit, cxButtonEdit,
StdCtrls, ToolWin, DBClient, ADODB, ExtCtrls, BtnEdit, cxCalendar, StrUtils,
cxCurrencyEdit, cxImage, cxDBEdit, Menus, RM_Common, RM_Class, RM_e_Xls,
RM_Dataset, RM_System, RM_GridReport, cxGridCustomPopupMenu, cxGridPopupMenu,
cxPC, cxSplitter, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
IdFTP, ShellAPI, cxCheckBox, cxLookAndFeels, cxLookAndFeelPainters,
cxNavigator, dxBarBuiltInMenu, dxSkinsCore, dxSkinsDefaultPainters,
dxDateRanges, IdExplicitTLSClientServerBase, U_BaseList;
type
TfrmDyePlanCardList = class(TfrmBaseList)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBFind: TToolButton;
TBAdd: TToolButton;
TBDel: TToolButton;
TBPrint: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
Label1: TLabel;
Tv1: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
cxGrid1: TcxGrid;
GPM_1: TcxGridPopupMenu;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
DS_1: TDataSource;
Label3: TLabel;
OrderNo: TEdit;
TBExport: TToolButton;
v1OrderNo: TcxGridDBColumn;
v1OrdDate: TcxGridDBColumn;
v1DeliveryDate: TcxGridDBColumn;
v1ConNo: TcxGridDBColumn;
v1MPRTSpec: TcxGridDBColumn;
CDS_1: TClientDataSet;
RM1: TRMGridReport;
RMDB_1: TRMDBDataSet;
v1CustomerNoName: TcxGridDBColumn;
Label4: TLabel;
CustName: TEdit;
v1MPRTCodeName: TcxGridDBColumn;
v1MPRTMF: TcxGridDBColumn;
Label8: TLabel;
C_Name: TEdit;
Label9: TLabel;
ConNo: TEdit;
v1MPRTKZ: TcxGridDBColumn;
Label10: TLabel;
C_Spec: TEdit;
Label12: TLabel;
MPRTKZ: TEdit;
ADOQueryPrint: TADOQuery;
v1Column1: TcxGridDBColumn;
v1Column2: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
Tchk: TToolButton;
Tnochk: TToolButton;
v1Column6: TcxGridDBColumn;
v1Column5: TcxGridDBColumn;
v1Column9: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
v1Column11: TcxGridDBColumn;
ThreeColorBase: TcxStyleRepository;
SHuangSe: TcxStyle;
SkyBlue: TcxStyle;
Default: TcxStyle;
QHuangSe: TcxStyle;
Red: TcxStyle;
FontBlue: TcxStyle;
TextSHuangSe: TcxStyle;
FonePurple: TcxStyle;
FoneClMaroon: TcxStyle;
FoneRed: TcxStyle;
RowColor: TcxStyle;
handBlack: TcxStyle;
cxBlue: TcxStyle;
cxStyle1: TcxStyle;
v1Column12: TcxGridDBColumn;
PCID: TEdit;
Label2: TLabel;
v1Column13: TcxGridDBColumn;
v1Column14: TcxGridDBColumn;
v1Column17: TcxGridDBColumn;
v1Column19: TcxGridDBColumn;
v1Column20: TcxGridDBColumn;
C_ColorNo: TEdit;
Label5: TLabel;
C_Color: TEdit;
Label6: TLabel;
Tv1Column3: TcxGridDBColumn;
Tv1Column6: TcxGridDBColumn;
Tv1Column13: TcxGridDBColumn;
Tv1Column19: TcxGridDBColumn;
Tv1Column20: TcxGridDBColumn;
ToolButton6: TToolButton;
cxTabControl1: TcxTabControl;
PM_1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
tbedit: TToolButton;
btnWC: TToolButton;
btnnowc: TToolButton;
Tv1Column1: TcxGridDBColumn;
Tv1Column4: TcxGridDBColumn;
Tv1Column5: TcxGridDBColumn;
Tv1Column7: TcxGridDBColumn;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure TBFindClick(Sender: TObject);
procedure TBDelClick(Sender: TObject);
procedure TBExportClick(Sender: TObject);
procedure TBPrintClick(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure TBAddClick(Sender: TObject);
procedure OrderNoChange(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure CheckBox2Click(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure cxTabControl1Change(Sender: TObject);
procedure TchkClick(Sender: TObject);
procedure TnochkClick(Sender: TObject);
procedure Label2DblClick(Sender: TObject);
procedure ToolButton6Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure tbeditClick(Sender: TObject);
procedure btnWCClick(Sender: TObject);
procedure btnnowcClick(Sender: TObject);
private
DQdate: TDateTime;
procedure InitGrid();
procedure SetStatus();
procedure InitForm();
// procedure SetStatus();
{ Private declarations }
public
FFInt, FCloth: Integer;
canshu1, canshu2, FWorkshop: string;
fFlileFlag: string;
{ Public declarations }
end;
var
frmDyePlanCardList: TfrmDyePlanCardList;
implementation
uses
U_DataLink, U_RTFun, U_DyePlanCardInput, U_LabelPrint;
{$R *.dfm}
procedure TfrmDyePlanCardList.SetStatus();
begin
tchk.Enabled := false;
tnochk.Enabled := false;
tbadd.Enabled := false;
tbedit.Enabled := false;
tbdel.Enabled := false;
btnWC.Enabled := false;
btnnowc.Enabled := false;
tbadd.Enabled := true;
if Trim(canshu1) = <><C2BC>' then
begin
case cxTabControl1.TabIndex of
0:
begin
tbedit.Enabled := true;
tbdel.Enabled := true;
tchk.Enabled := true;
end;
1:
begin
tnochk.Enabled := true;
btnWC.Enabled := true;
end;
2:
begin
btnnowc.Enabled := true;
end;
3:
begin
end;
end;
end;
if Trim(canshu1) = '<27><><EFBFBD><EFBFBD>' then
begin
case cxTabControl1.TabIndex of
0:
begin
tbedit.Enabled := true;
tbdel.Enabled := true;
tchk.Enabled := true;
end;
1:
begin
tnochk.Enabled := true;
btnWC.Enabled := true;
end;
2:
begin
btnnowc.Enabled := true;
end;
3:
begin
end;
end;
end;
end;
procedure TfrmDyePlanCardList.FormDestroy(Sender: TObject);
begin
inherited;
frmDyePlanCardList := nil;
end;
procedure TfrmDyePlanCardList.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
Action := caFree;
end;
procedure TfrmDyePlanCardList.FormCreate(Sender: TObject);
begin
inherited;
cxgrid1.Align := alClient;
DQdate := SGetServerDate(ADOQueryTemp);
canshu1 := trim(Self.fParameters1);
canshu2 := trim(Self.fParameters2);
FWorkshop := trim(Self.fParameters3);
end;
procedure TfrmDyePlanCardList.TBCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmDyePlanCardList.InitGrid();
var
strwhere: string;
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_Dye_Card_PSC ');
execsql;
end;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Close;
Filtered := False;
sql.Clear;
sql.Add('select A.*,ConNo,OrdType,Salestype ,OrdDate,DlyDate');
sql.Add(',GlideList=[dbo].[F_Dye_Card_GlideList](A.PCID) ');
sql.Add('from Dye_Plan_Card A ');
sql.Add('left join Dye_Plan_sub B on B.subID=A.subID ');
sql.Add('left join Dye_Plan_Main C on C.mainID=A.mainID ');
sql.Add('where A.PCTime>=''' + formatdateTime('yyyy-MM-dd', begdate.Date) + ''' ');
sql.Add('and A.PCTime<''' + formatdateTime('yyyy-MM-dd', enddate.Date + 1) + ''' ');
case cxTabControl1.TabIndex of
0:
begin
sql.Add(' and isnull(A.status,''0'')=''0'' ');
end;
1:
begin
sql.Add(' and isnull(A.status,''0'')=''9'' ');
end;
2:
begin
sql.Add(' and isnull(A.status,''0'')=''10'' ');
end;
end;
if trim(FWorkshop) <> '' then
sql.Add(' and C.Workshop=''' + trim(FWorkshop) + ''' ');
if Trim(canshu1) = '' then
sql.Add(' and A.Filler=''' + trim(DName) + ''' ');
Open;
end;
SCreateCDS(ADOQueryMain, CDS_1);
SInitCDSData(ADOQueryMain, CDS_1);
finally
ADOQueryMain.EnableControls;
TBFind.Click;
end;
end;
procedure TfrmDyePlanCardList.Label2DblClick(Sender: TObject);
var
I: Integer;
Column: TcxGridDBColumn;
FieldNames: TStringList;
begin
FieldNames := TStringList.Create;
try
for I := 0 to Tv1.ColumnCount - 1 do
begin
Column := Tv1.Columns[I];
FieldNames.Add(Column.Caption + ':' + Column.DataBinding.FieldName);
end;
ShowMessage(FieldNames.Text);
finally
FieldNames.Free;
end;
end;
procedure TfrmDyePlanCardList.InitForm();
begin
ReadCxGrid(self.Caption + 'TV1', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
BegDate.DateTime := SGetServerDate(ADOQueryTemp) - 3;
EndDate.DateTime := SGetServerDate(ADOQueryTemp);
SetStatus();
InitGrid()
end;
procedure TfrmDyePlanCardList.TBFindClick(Sender: TObject);
begin
if ADOQueryMain.Active = False then
Exit;
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS(ADOQueryMain, CDS_1);
SInitCDSData(ADOQueryMain, CDS_1);
end;
procedure TfrmDyePlanCardList.TBDelClick(Sender: TObject);
begin
if CDS_1.IsEmpty then
Exit;
if (Trim(CDS_1.fieldbyname('Filler').AsString) <> Trim(DName)) and (dname <> 'ADMIN') then
begin
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if CDS_1.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
try
with CDS_1 do
begin
DisableControls;
First;
while not Eof do
begin
if Fieldbyname('Ssel').AsBoolean then
begin
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
Sql.Clear;
Sql.Add('exec P_Dye_Card_Del ');
Sql.Add('@PCIDS=' + quotedstr(Trim(CDS_1.fieldbyname('PCID').AsString)));
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
Open;
end;
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
if (Trim(CDS_1.fieldbyname('PCType').AsString) = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') or (Trim(CDS_1.fieldbyname('PCType').AsString) = <><C7B0><EFBFBD><EFBFBD>') then
begin
with ADOQueryCmd do
begin
Close;
Sql.Clear;
Sql.Add('exec P_Dye_GreyCloth_Out_Del ');
Sql.Add('@PCID=' + quotedstr(Trim(CDS_1.fieldbyname('PCID').AsString)));
Open;
end;
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
end
else
begin
with ADOQueryCmd do
begin
Close;
Sql.Clear;
Sql.Add('exec P_Dye_Card_Move_Del ');
Sql.Add('@PCID=' + quotedstr(Trim(CDS_1.fieldbyname('PCID').AsString)));
Open;
end;
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
end;
ADOQueryCmd.Connection.CommitTrans;
except
ADOQueryCmd.Connection.RollbackTrans;
raise Exception.Create(PChar(Exception(ExceptObject).Message));
end;
end;
Next;
end;
EnableControls;
end;
TBRafresh.Click;
except
CDS_1.EnableControls;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmDyePlanCardList.TBExportClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then
Exit;
// SelExportData(Tv1,ADOQueryMain,self.Caption);
end;
procedure TfrmDyePlanCardList.TBPrintClick(Sender: TObject);
var
WSql: string;
begin
WSql := '';
if CDS_1.IsEmpty then
Exit;
if CDS_1.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
with CDS_1 do
begin
DisableControls;
First;
while not Eof do
begin
if Fieldbyname('Ssel').AsBoolean then
begin
if WSql = '' then
WSql := trim(CDS_1.fieldbyname('PCID').AsString)
else
WSql := WSql + ',' + trim(CDS_1.fieldbyname('PCID').AsString);
end;
Next;
end;
EnableControls;
end;
try
frmLabelPrint := TfrmLabelPrint.Create(Application);
with frmLabelPrint do
begin
FLMType := 'DyeCardPrint';
FFiltration1 := WSql;
if ShowModal = 1 then
begin
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update Dye_Plan_Card SET status=''9'' ,chker=''' + trim(DName) + ''',Chktime=getdate() ');
sql.Add(' where EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + quotedstr(WSql) + ','','') X where X.RTValue=Dye_Plan_Card.PCID ) ');
execsql;
end;
end;
end;
finally
frmLabelPrint.Free;
end;
InitGrid();
end;
procedure TfrmDyePlanCardList.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmDyePlanCardList.TBAddClick(Sender: TObject);
begin
try
frmDyePlanCardInput := TfrmDyePlanCardInput.Create(Application);
with frmDyePlanCardInput do
begin
FPCIDS := '';
FWorkshop := self.FWorkshop;
if ShowModal = 1 then
begin
InitGrid();
end;
end;
finally
frmDyePlanCardInput.Free;
end;
end;
procedure TfrmDyePlanCardList.OrderNoChange(Sender: TObject);
begin
if ADOQueryMain.Active = False then
Exit;
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS(ADOQueryMain, CDS_1);
SInitCDSData(ADOQueryMain, CDS_1);
end;
procedure TfrmDyePlanCardList.FormShow(Sender: TObject);
begin
inherited;
fFlileFlag := UserDataFlag + 'HX';
canshu1 := self.fParameters1;
canshu2 := self.fParameters3;
FWorkshop := self.fParameters3;
InitForm();
end;
procedure TfrmDyePlanCardList.CheckBox2Click(Sender: TObject);
begin
TBRafresh.Click;
end;
procedure TfrmDyePlanCardList.N1Click(Sender: TObject);
begin
SelOKNo(CDS_1, true);
end;
procedure TfrmDyePlanCardList.N2Click(Sender: TObject);
begin
SelOKNo(CDS_1, False);
end;
procedure TfrmDyePlanCardList.tbeditClick(Sender: TObject);
var
MPCIDS: string;
begin
with CDS_1 do
begin
DisableControls;
First;
while not Eof do
begin
if Fieldbyname('Ssel').AsBoolean then
begin
MPCIDS := MPCIDS + trim(CDS_1.FieldByName('PCID').AsString) + ';';
end;
Next;
end;
EnableControls;
end;
try
frmDyePlanCardInput := TfrmDyePlanCardInput.Create(Application);
with frmDyePlanCardInput do
begin
FPCIDS := MPCIDS;
FWorkshop := self.FWorkshop;
if ShowModal = 1 then
begin
InitGrid();
end;
end;
finally
frmDyePlanCardInput.Free;
end;
end;
procedure TfrmDyePlanCardList.btnWCClick(Sender: TObject);
begin
if CDS_1.IsEmpty then
exit;
if CDS_1.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
try
ADOQueryCmd.Connection.BeginTrans;
with CDS_1 do
begin
DisableControls;
First;
while not Eof do
begin
if Fieldbyname('Ssel').AsBoolean then
begin
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update Dye_Plan_Card SET status=''10'' ');
sql.Add('where PCID=' + quotedstr(trim(CDS_1.fieldbyname('PCID').AsString)));
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
sql.Add(' ' + quotedstr(trim(DName)));
sql.Add(',getdate() ');
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD>')));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>̿<EFBFBD><CCBF>ţ<EFBFBD>' + trim(CDS_1.FieldByName('PCID').AsString))));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(')');
execsql;
end;
end;
Next;
end;
EnableControls;
end;
ADOQueryCmd.Connection.CommitTrans;
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
TBRafresh.Click;
except
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmDyePlanCardList.btnnowcClick(Sender: TObject);
begin
if CDS_1.IsEmpty then
exit;
if CDS_1.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
try
ADOQueryCmd.Connection.BeginTrans;
with CDS_1 do
begin
DisableControls;
First;
while not Eof do
begin
if Fieldbyname('Ssel').AsBoolean then
begin
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update Dye_Plan_Card SET status=''9'' ');
sql.Add('where PCID=' + quotedstr(trim(CDS_1.fieldbyname('PCID').AsString)));
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
sql.Add(' ' + quotedstr(trim(DName)));
sql.Add(',getdate() ');
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>̿<EFBFBD><CCBF>ţ<EFBFBD>' + trim(CDS_1.FieldByName('PCID').AsString))));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(')');
execsql;
end;
end;
Next;
end;
EnableControls;
end;
ADOQueryCmd.Connection.CommitTrans;
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
TBRafresh.Click;
except
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmDyePlanCardList.ToolButton6Click(Sender: TObject);
begin
WriteCxGrid(self.Caption + 'TV1', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmDyePlanCardList.cxTabControl1Change(Sender: TObject);
begin
SetStatus();
InitGrid();
end;
procedure TfrmDyePlanCardList.TchkClick(Sender: TObject);
begin
if CDS_1.IsEmpty then
exit;
if CDS_1.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
try
ADOQueryCmd.Connection.BeginTrans;
with CDS_1 do
begin
DisableControls;
First;
while not Eof do
begin
if Fieldbyname('Ssel').AsBoolean then
begin
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update Dye_Plan_Card SET status=''9'' ');
sql.Add('where PCID=' + quotedstr(trim(CDS_1.fieldbyname('PCID').AsString)));
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
sql.Add(' ' + quotedstr(trim(DName)));
sql.Add(',getdate() ');
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD>')));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>̿<EFBFBD><CCBF>ţ<EFBFBD>' + trim(CDS_1.FieldByName('PCID').AsString))));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(')');
execsql;
end;
end;
Next;
end;
EnableControls;
end;
ADOQueryCmd.Connection.CommitTrans;
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
TBRafresh.Click;
except
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmDyePlanCardList.TnochkClick(Sender: TObject);
begin
if CDS_1.IsEmpty then
exit;
if CDS_1.Locate('SSel', True, []) = False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
try
ADOQueryCmd.Connection.BeginTrans;
with CDS_1 do
begin
DisableControls;
First;
while not Eof do
begin
if Fieldbyname('Ssel').AsBoolean then
begin
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update Dye_Plan_Card SET status=''0'' ');
sql.Add('where PCID=' + quotedstr(trim(CDS_1.fieldbyname('PCID').AsString)));
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
sql.Add(' ' + quotedstr(trim(DName)));
sql.Add(',getdate() ');
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD>')));
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>̿<EFBFBD><CCBF>ţ<EFBFBD>' + trim(CDS_1.FieldByName('PCID').AsString))));
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
sql.Add(')');
execsql;
end;
end;
Next;
end;
EnableControls;
end;
ADOQueryCmd.Connection.CommitTrans;
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
TBRafresh.Click;
except
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
end.