228 lines
6.4 KiB
ObjectPascal
228 lines
6.4 KiB
ObjectPascal
unit U_KnitDRQuickInPut;
|
||
|
||
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,
|
||
cxDropDownEdit, cxGridCustomPopupMenu, cxGridPopupMenu, cxLookAndFeels,
|
||
cxLookAndFeelPainters, cxNavigator, dxSkinsCore, dxSkinsDefaultPainters,
|
||
dxDateRanges, dxBarBuiltInMenu, U_BaseList, dxSkinBasic, dxSkinBlack,
|
||
dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkroom,
|
||
dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
|
||
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
|
||
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
||
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
||
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
||
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
||
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
|
||
dxSkinOffice2013White, dxSkinOffice2016Colorful, dxSkinOffice2016Dark,
|
||
dxSkinOffice2019Black, dxSkinOffice2019Colorful, dxSkinOffice2019DarkGray,
|
||
dxSkinOffice2019White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
|
||
dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringtime, dxSkinStardust,
|
||
dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinTheBezier, dxSkinValentine,
|
||
dxSkinVisualStudio2013Blue, dxSkinVisualStudio2013Dark,
|
||
dxSkinVisualStudio2013Light, dxSkinVS2010, dxSkinWhiteprint, dxSkinWXI,
|
||
dxSkinXmas2008Blue, dxCore, cxDateUtils;
|
||
|
||
type
|
||
TfrmKnitDRQuickInPut = class(Tform)
|
||
ToolBar1: TToolBar;
|
||
TBSave: TToolButton;
|
||
TBClose: TToolButton;
|
||
ScrollBox1: TScrollBox;
|
||
ADOTemp: TADOQuery;
|
||
ADOCmd: TADOQuery;
|
||
ADOQuery1: TADOQuery;
|
||
Label1: TLabel;
|
||
Note: TcxTextEdit;
|
||
Label12: TLabel;
|
||
Label11: TLabel;
|
||
cxStyleRepository1: TcxStyleRepository;
|
||
dazi1: TcxStyle;
|
||
Label2: TLabel;
|
||
Label27: TLabel;
|
||
QtyUnit: TComboBox;
|
||
Label5: TLabel;
|
||
DRAddWet: TcxTextEdit;
|
||
DlyDate: TcxDateEdit;
|
||
OutType: TcxComboBox;
|
||
ToCoName: TcxButtonEdit;
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBSaveClick(Sender: TObject);
|
||
procedure ToCoNameDblClick(Sender: TObject);
|
||
procedure ToCoNameOnButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
private
|
||
fuserName: string;
|
||
procedure InitData();
|
||
function SaveData(): Boolean;
|
||
{ Private declarations }
|
||
public
|
||
PState, CopyInt: Integer;
|
||
FDRMID: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmKnitDRQuickInPut: TfrmKnitDRQuickInPut;
|
||
newh: hwnd;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_ZDYHelp, U_RTFun, U_CompanySel;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmKnitDRQuickInPut.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmKnitDRQuickInPut.InitData();
|
||
var
|
||
fsj: string;
|
||
begin
|
||
if PState = 0 then
|
||
begin
|
||
DlyDate.Date := strtodatetime(Trim(FormatDateTime('yyyy-MM-dd', Now)));
|
||
end;
|
||
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.* ');
|
||
sql.Add(' from Knit_Cloth_DR_Main A');
|
||
sql.Add(' where DRMID=''' + Trim(FDRMID) + ''' ');
|
||
Open;
|
||
end;
|
||
SCSHData(ADOQuery1, ScrollBox1, 1);
|
||
ToCoName.Properties.LookupItems.Text := ADOQuery1.FieldByName('ToCoNo').asstring;
|
||
end;
|
||
|
||
|
||
procedure TfrmKnitDRQuickInPut.FormShow(Sender: TObject);
|
||
begin
|
||
InitData();
|
||
end;
|
||
|
||
function TfrmKnitDRQuickInPut.SaveData(): Boolean;
|
||
var
|
||
MaxMid, MaxSid: string;
|
||
begin
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
///////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> /////////////////
|
||
if Trim(FDRMID) = '' then
|
||
begin
|
||
if GetLSNo(ADOCmd, MaxMid, 'DM', 'Knit_Cloth_DR_Main', 4, 1) = False then
|
||
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
||
end
|
||
else
|
||
begin
|
||
MaxMid := Trim(FDRMID);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from Knit_Cloth_DR_Main where DRMID=''' + Trim(MaxMid) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(FDRMID) = '' then
|
||
begin
|
||
Append;
|
||
FieldByName('FillID').Value := Trim(DCode);
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
FieldByName('EditID').Value := Trim(DCode);
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('EditTime').Value := SGetServerDateTime(ADOTemp);
|
||
end;
|
||
RTSetsavedata(ADOCmd, 'Knit_Cloth_DR_Main', ScrollBox1, 1);
|
||
FieldByName('DRMID').Value := Trim(MaxMid);
|
||
FieldByName('ToCoNo').Value := Trim(ToCoName.Properties.LookupItems.Text);
|
||
|
||
FieldByName('Status').Value := '9';
|
||
Post;
|
||
end;
|
||
///////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> /////////////////
|
||
|
||
FDRMID := Trim(MaxMid);
|
||
ADOCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
ADOCmd.Connection.RollbackTrans;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
Result := False;
|
||
end;
|
||
end;
|
||
|
||
|
||
|
||
procedure TfrmKnitDRQuickInPut.TBSaveClick(Sender: TObject);
|
||
var
|
||
Freal: Double;
|
||
begin
|
||
ToolBar1.SetFocus;
|
||
|
||
if Trim(OutType.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Trim(ToCoName.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27>ջ<EFBFBD><D5BB><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
||
ModalResult := 1;
|
||
end;
|
||
end;
|
||
|
||
|
||
procedure TfrmKnitDRQuickInPut.ToCoNameDblClick(Sender: TObject);
|
||
begin
|
||
ToCoName.Text := '';
|
||
ToCoName.Properties.LookupItems.Text := '';
|
||
end;
|
||
|
||
procedure TfrmKnitDRQuickInPut.ToCoNameOnButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
FCoType := '<27>ͻ<EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
self.ToCoName.Properties.LookupItems.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString);
|
||
self.ToCoName.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoAbbrName').AsString);
|
||
end;
|
||
end;
|
||
|
||
finally
|
||
frmCompanySel.Free;
|
||
end;
|
||
end;
|
||
|
||
|
||
end.
|
||
|