269 lines
7.1 KiB
ObjectPascal
269 lines
7.1 KiB
ObjectPascal
unit U_ClothInfoProcessInput;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
|
||
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin, StdCtrls,
|
||
cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
||
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
||
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
||
IdTCPClient, IdFTP, ShellAPI, IniFiles, cxCheckBox, cxCalendar, cxButtonEdit,
|
||
cxTextEdit, cxDropDownEdit, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
||
dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu;
|
||
|
||
type
|
||
TfrmClothInfoProcessInput = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBClose: TToolButton;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
GPM_2: TcxGridPopupMenu;
|
||
DS_HZ: TDataSource;
|
||
CDS_HZ: TClientDataSet;
|
||
ToolButton3: TToolButton;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
v2PSName: TcxGridDBColumn;
|
||
v2PSNote: TcxGridDBColumn;
|
||
v2Column1: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
v2SYRName: TcxGridDBColumn;
|
||
vLDPrice: TcxGridDBColumn;
|
||
ToolButton1: TToolButton;
|
||
ToolButton2: TToolButton;
|
||
ToolButton4: TToolButton;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure v2SYRNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
procedure InitGrid();
|
||
function SaveData(): Boolean;
|
||
public
|
||
{ Public declarations }
|
||
RKFlag, FCYID: string;
|
||
fDEFstr5: string;
|
||
end;
|
||
|
||
var
|
||
frmClothInfoProcessInput: TfrmClothInfoProcessInput;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_ZDYHelp;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmClothInfoProcessInput.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from Bs_Cloth_Process where PSID=''' + Trim(FCYID) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryMain, CDS_HZ);
|
||
SInitCDSData(ADOQueryMain, CDS_HZ);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothInfoProcessInput.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmClothInfoProcessInput := nil;
|
||
end;
|
||
|
||
procedure TfrmClothInfoProcessInput.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmClothInfoProcessInput.TBCloseClick(Sender: TObject);
|
||
begin
|
||
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmClothInfoProcessInput.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid(trim(Self.Caption), Tv2, 'Ⱦɫ<C8BE>ƻ<EFBFBD>');
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmClothInfoProcessInput.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
function TfrmClothInfoProcessInput.SaveData(): Boolean;
|
||
var
|
||
maxId, CRID, fzdyCode, FFFlag, FStr: string;
|
||
begin
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with CDS_HZ do
|
||
begin
|
||
first;
|
||
while not Eof do
|
||
begin
|
||
if Trim(fieldbyname('PSID').AsString) = '' then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd, maxId, 'JP', 'Bs_Cloth_Process', 4, 1) = False then
|
||
begin
|
||
Result := False;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
maxId := Trim(FCYID);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from Bs_Cloth_Process where PSID=''' + Trim(FCYID) + '''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(FCYID) = '' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('Edittime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
end;
|
||
FieldByName('PSID').Value := Trim(maxId);
|
||
RTSetSaveDataCDS(ADOQueryCmd, Tv2, CDS_HZ, 'Bs_Cloth_Process', 0);
|
||
Post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from Bs_Cloth_Process where PSName=''' + Trim(CDS_HZ.fieldbyname('PSName').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.RecordCount > 1 then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox(PChar('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + trim(ADOQueryCmd.fieldbyname('PSName').AsString) + '<27>Ѵ<EFBFBD><D1B4><EFBFBD>'), '<27><>ʾ');
|
||
Exit;
|
||
end;
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('PSID').Value := Trim(maxId);
|
||
end;
|
||
next;
|
||
end;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
;
|
||
Result := True;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothInfoProcessInput.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
cxGrid2.SetFocus;
|
||
if Trim(CDS_HZ.FieldByName('PSName').AsString) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
||
ModalResult := 1;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothInfoProcessInput.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(trim(Self.Caption), Tv2, 'Ⱦɫ<C8BE>ƻ<EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmClothInfoProcessInput.v2SYRNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'CJName';
|
||
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('Workshop').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
;
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothInfoProcessInput.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
with CDS_HZ do
|
||
begin
|
||
Append;
|
||
post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothInfoProcessInput.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.IsEmpty then
|
||
exit;
|
||
if application.MessageBox('ȷ<><C8B7>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>', '<27><>ʾ', 1) = 2 then
|
||
exit;
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
SQL.Clear;
|
||
sql.Add('delete from Bs_Cloth_Process where PSId=''' + trim(CDS_HZ.fieldbyname('PSID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
CDS_HZ.Delete;
|
||
end;
|
||
|
||
end.
|
||
|