288 lines
7.1 KiB
ObjectPascal
288 lines
7.1 KiB
ObjectPascal
|
|
unit U_JGSXCKOutPut;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
|||
|
|
cxDataStorage, cxEdit, DB, cxDBData, cxCalendar, cxDropDownEdit,
|
|||
|
|
ComCtrls, ToolWin, cxGridLevel, cxGridCustomTableView, cxGridTableView,
|
|||
|
|
cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid,
|
|||
|
|
cxGridCustomPopupMenu, cxGridPopupMenu, ADODB, DBClient, cxButtonEdit,
|
|||
|
|
cxTextEdit, cxSpinEdit;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmJGSXCKOutPut = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBAdd: TToolButton;
|
|||
|
|
TBDel: TToolButton;
|
|||
|
|
TBSave: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
DataSource3: TDataSource;
|
|||
|
|
CDS_Sub: TClientDataSet;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
v1Column2: TcxGridDBColumn;
|
|||
|
|
v1CRType: TcxGridDBColumn;
|
|||
|
|
v2Column6: TcxGridDBColumn;
|
|||
|
|
v1Column3: TcxGridDBColumn;
|
|||
|
|
v1Column12: TcxGridDBColumn;
|
|||
|
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
|
v1YLName: TcxGridDBColumn;
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure TBAddClick(Sender: TObject);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure TBDelClick(Sender: TObject);
|
|||
|
|
procedure TBSaveClick(Sender: TObject);
|
|||
|
|
procedure v1YLNamePropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
procedure v1CRTypePropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
procedure v1Column3PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
private
|
|||
|
|
{ Private declarations }
|
|||
|
|
function SaveCKData():Boolean;
|
|||
|
|
function YFData():Boolean;
|
|||
|
|
public
|
|||
|
|
{ Public declarations }
|
|||
|
|
FBCId:String;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmJGSXCKOutPut: TfrmJGSXCKOutPut;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
uses
|
|||
|
|
U_DataLink,U_RTFun,U_ClothContractListHZCX,U_ZDYHelp,U_SXCKKCSelList,
|
|||
|
|
U_GYSSelList, U_ZdyAttachGYS, U_ProductOrderListSel, U_JGSXCKKCSelList,
|
|||
|
|
U_JGPBCKKCList;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
function TfrmJGSXCKOutPut.YFData():Boolean;
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGSXCKOutPut.FormClose(Sender: TObject;
|
|||
|
|
var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Action:=caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGSXCKOutPut.TBAddClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('CRTime').Value:=SGetServerDate10(ADOQueryTemp);
|
|||
|
|
post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmJGSXCKOutPut.SaveCKData():Boolean;
|
|||
|
|
var
|
|||
|
|
FCRID,Maxno,FSPID,MaxPYNo,FPYID:string;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
CDS_Sub.DisableControls;
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from CK_SXPB_CR where SPID='''+Trim(CDS_Sub.fieldbyname('SPID').AsString)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
FSPID:=Trim(ADOQueryTemp.fieldbyname('SPID').AsString);
|
|||
|
|
if Trim(FSPID)='' then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOQueryCmd,Maxno,'CY','CK_SXPB_CR',3,1)=False then
|
|||
|
|
begin
|
|||
|
|
Result:=False;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
Maxno:=Trim(FSPID);
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from CK_SXPB_CR where SPID='''+Trim(Maxno)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
if Trim(FSPID)='' then
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
end;
|
|||
|
|
FieldByName('SPID').Value:=Trim(Maxno);
|
|||
|
|
RTSetSaveDataCDS(ADOQueryCmd,Tv1,CDS_Sub,'CK_SXPB_CR',2);
|
|||
|
|
FieldByName('CKName').Value:='ԭ<><D4AD>';
|
|||
|
|
FieldByName('CRFlag').Value:='<27><><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('CRQtyFlag').Value:=-1;
|
|||
|
|
FieldByName('Qty').Value:=CDS_Sub.fieldbyname('Qty').AsFloat;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('SPID').Value:=Trim(Maxno);
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
CDS_Sub.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
Result:=True;
|
|||
|
|
except;
|
|||
|
|
Result:=False;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGSXCKOutPut.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid('<27><><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD>Ǽ<EFBFBD>PMD',Tv1,'ԭ<>ϲֿ<CFB2>');
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGSXCKOutPut.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ReadCxGrid('<27><><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD>Ǽ<EFBFBD>PMD',Tv1,'ԭ<>ϲֿ<CFB2>');
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select A.* ');
|
|||
|
|
sql.Add(' from CK_SXPB_CR A');
|
|||
|
|
sql.Add(' where SPID='''+Trim(FBCId)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryTemp,CDS_Sub);
|
|||
|
|
SInitCDSData20(ADOQueryTemp,CDS_Sub);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGSXCKOutPut.TBDelClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_Sub.IsEmpty then Exit;
|
|||
|
|
CDS_Sub.Delete;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGSXCKOutPut.TBSaveClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_Sub.IsEmpty then Exit;
|
|||
|
|
if CDS_Sub.Locate('CRTime',null,[])=True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʱ<EFBFBD>䲻<EFBFBD><E4B2BB>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if CDS_Sub.Locate('CRType',null,[])=True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if CDS_Sub.Locate('Qty',null,[])=True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if SaveCKData() then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
//ModalResult:=1;
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGSXCKOutPut.v1YLNamePropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag:='YLName1';
|
|||
|
|
flagname:='ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('YLName').Value:=Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally;
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGSXCKOutPut.v1CRTypePropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag:='CRType1';
|
|||
|
|
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('CRType').Value:=Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally;
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmJGSXCKOutPut.v1Column3PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag:='QtyUnit1';
|
|||
|
|
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ';
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('QtyUnit').Value:=Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally;
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|