📄 newproductunit.pas
字号:
unit NewProductUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxPC, cxControls, RzPanel, RzButton, ImgList, ExtCtrls, DB,
ADODB, ActnList, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxCalendar,
cxGroupBox, cxContainer, cxEdit, cxLabel, cxGraphics, cxCheckComboBox,
cxMemo, cxCheckBox, cxLookupEdit, cxDBLookupEdit, cxDBExtLookupComboBox,
cxDBEdit, cxDBLookupComboBox, cxDBCheckComboBox, Grids, DBGrids,
cxButtonEdit;
type
TNewProductForm = class(TForm)
MainPC: TcxPageControl;
MainTS: TcxTabSheet;
Toolbar: TRzToolbar;
NewBtn: TRzToolButton;
RzSpacer1: TRzSpacer;
BtnSkipBackward: TRzToolButton;
BtnPreviousRecord: TRzToolButton;
BtnNextRecord: TRzToolButton;
BtnSkipForward: TRzToolButton;
BtnEdit1: TRzToolButton;
BtnSave: TRzToolButton;
BtnDelete: TRzToolButton;
BtnRefresh: TRzToolButton;
RzSpacer2: TRzSpacer;
Exit: TRzToolButton;
TranList: TActionList;
Query: TAction;
Add: TAction;
Change: TAction;
Save: TAction;
Cancel: TAction;
Delete: TAction;
First: TAction;
Prior: TAction;
Next: TAction;
Last: TAction;
Check: TAction;
BtnPrintPreview: TRzToolButton;
ImageList: TImageList;
Label_Main: TcxLabel;
GB_01: TcxGroupBox;
Type_Label: TcxLabel;
Size_Label: TcxLabel;
Number_Label: TcxLabel;
Label_Label: TcxLabel;
UnitGroup_Label: TcxLabel;
Color_Label: TcxLabel;
Unit_Label: TcxLabel;
Color_CCB: TcxCheckComboBox;
Size_CCB: TcxCheckComboBox;
Number_TE: TcxTextEdit;
ProductMemo_Label: TcxLabel;
ProductMemo_TE: TcxTextEdit;
GB_02: TcxGroupBox;
Agree_Label: TcxLabel;
LabelNO_Label: TcxLabel;
ChangeLabel_Label: TcxLabel;
cxLabel21: TcxLabel;
cxLabel22: TcxLabel;
cxLabel23: TcxLabel;
LoadColor_CCB: TcxCheckComboBox;
ChangeLabel_CB: TcxComboBox;
cxLabel24: TcxLabel;
Agree_CB: TcxCheckBox;
cxTextEdit6: TcxTextEdit;
cxLabel25: TcxLabel;
cxLabel26: TcxLabel;
cxLabel27: TcxLabel;
cxLabel28: TcxLabel;
cxTextEdit7: TcxTextEdit;
cxLabel29: TcxLabel;
cxTextEdit8: TcxTextEdit;
cxLabel17: TcxLabel;
cxLabel30: TcxLabel;
cxTextEdit10: TcxTextEdit;
cxMemo1: TcxMemo;
cxTextEdit5: TcxTextEdit;
cxTextEdit11: TcxTextEdit;
cxTextEdit12: TcxTextEdit;
cxComboBox4: TcxComboBox;
GB_03: TcxGroupBox;
cxLabel31: TcxLabel;
cxCheckBox3: TcxCheckBox;
cxMemo2: TcxMemo;
GB_00: TcxGroupBox;
Code_Label: TcxLabel;
Label_dDate: TcxLabel;
DE_dDate: TcxDateEdit;
Label_Create: TcxLabel;
Create_CBB: TcxComboBox;
GB_05: TcxGroupBox;
GB_04: TcxGroupBox;
cxLabel3: TcxLabel;
cxLabel38: TcxLabel;
cxTextEdit4: TcxTextEdit;
SQL: TADODataSet;
Vendor_Label: TcxLabel;
Vendor_CBB: TcxComboBox;
DMakerQty_Label: TcxLabel;
DMakerQty_TE: TcxTextEdit;
ReportPrice_Label: TcxLabel;
Person_Label: TcxLabel;
Person_CBB: TcxComboBox;
CupType_Label: TcxLabel;
SeasonType_Label: TcxLabel;
ImageType_Label: TcxLabel;
ReturnText_Label: TcxLabel;
RetrunText_TE: TcxTextEdit;
Type_CBB: TcxComboBox;
Label_CBB: TcxComboBox;
UnitGroup_CBB: TcxComboBox;
Unit_CBB: TcxComboBox;
CupType_CBB: TcxComboBox;
SeasonType_CBB: TcxComboBox;
BowlType_CBB: TcxComboBox;
ImageType_CBB: TcxComboBox;
ReportPrice_TE: TcxTextEdit;
BowlType_Label: TcxLabel;
CodeText_Label: TcxLabel;
LabelNO_TE: TcxTextEdit;
cxDateEdit1: TcxDateEdit;
BtnUpOneLevel: TRzToolButton;
cxDateEdit2: TcxDateEdit;
BtnWarning: TRzToolButton;
RzToolbar1: TRzToolbar;
BtnAttachFiles: TRzToolButton;
BtnAttachFiles1: TRzToolButton;
BtnAttachFiles2: TRzToolButton;
RzSpacer3: TRzSpacer;
RzSpacer4: TRzSpacer;
RzSpacer5: TRzSpacer;
procedure ExitClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure CCB_UnitGroupPropertiesChange(Sender: TObject);
procedure CB_AgreePropertiesChange(Sender: TObject);
procedure CCB_VendorPropertiesChange(Sender: TObject);
procedure BtnChangeOptionsClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
NewProductForm: TNewProductForm;
implementation
{$R *.dfm}
procedure TNewProductForm.ExitClick(Sender: TObject);
begin
NewProductForm.Close;
NewProductForm.Free;
end;
procedure TNewProductForm.FormCreate(Sender: TObject);
begin
GB_00.Style.BorderStyle := ebsNone ;
// 读入类别资料
SQL.Close;
SQL.CommandText := 'SELECT cInvCCode + '' - '' + cInvCName AS 名称 FROM InventoryClass WHERE (cInvCCode LIKE N''10%'') AND ({ fn LENGTH(cInvCCode) } = 4) ORDER BY cInvCCode';
SQL.Open ;
Type_CBB.Properties.Items.Clear;
While Not SQL.Eof do
Begin
Type_CBB.Properties.Items.Add(SQL.Fields[0].AsString);
SQL.next;
End;
// 读入品牌资料
SQL.Close;
SQL.CommandText := 'SELECT DISTINCT RIGHT(LEFT(cInvCode, 5), 3) + '' - '' + cLabel AS 品牌,cLabel, cInvDefine6 FROM Inventory ORDER BY cLabel,cInvDefine6 DESC';
SQL.Open ;
Label_CBB.Properties.Items.Clear;
While Not SQL.Eof do
Begin
Label_CBB.Properties.Items.Add(SQL.Fields[0].AsString);
SQL.next;
End;
// 读入单位组资料
SQL.Close;
SQL.CommandText := 'SELECT cGroupCode + '' - '' + cGroupName AS 单位组 FROM ComputationGroup ORDER BY cGroupName' ;
SQL.Open ;
UnitGroup_CBB.Properties.Items.Clear;
While Not SQL.Eof do
Begin
UnitGroup_CBB.Properties.Items.Add(SQL.Fields[0].AsString);
SQL.next;
End;
// 读入尺码资料
SQL.Close;
SQL.CommandText := 'SELECT cValue FROM UserDefine WHERE (cID = ''20'') ORDER BY cValue' ;
SQL.Open ;
Size_CCB.Properties.Items.Clear;
While Not SQL.Eof do
Begin
Size_CCB.Properties.Items.AddCheckItem(SQL.Fields[0].AsString,SQL.Fields[0].AsString);
SQL.next;
End;
// 读入颜色资料
SQL.Close;
SQL.CommandText := 'SELECT cValue FROM UserDefine WHERE (cID = ''21'') ORDER BY cValue' ;
SQL.Open ;
Color_CCB.Properties.Items.Clear;
While Not SQL.Eof do
Begin
Color_CCB.Properties.Items.AddCheckItem(SQL.Fields[0].AsString,SQL.Fields[0].AsString);
SQL.next;
End;
// 读入杯形资料
SQL.Close;
SQL.CommandText := 'SELECT cValue FROM UserDefine WHERE (cID = ''56'') ORDER BY cValue' ;
SQL.Open ;
CupType_CBB.Properties.Items.Clear;
While Not SQL.Eof do
Begin
CupType_CBB.Properties.Items.Add(SQL.Fields[0].AsString);
SQL.next;
End;
// 读入季节资料
SQL.Close;
SQL.CommandText := 'SELECT cValue FROM UserDefine WHERE (cID = ''57'') ORDER BY cValue' ;
SQL.Open ;
SeasonType_CBB.Properties.Items.Clear;
While Not SQL.Eof do
Begin
SeasonType_CBB.Properties.Items.Add(SQL.Fields[0].AsString);
SQL.next;
End;
// 读入供应商资料
SQL.Close;
SQL.CommandText := 'SELECT cVenCode + '' - '' + cVenAbbName + '' ---- '' + CASE WHEN iGradeABC = 0 THEN ''A'' ELSE (CASE WHEN iGradeABC = 1 THEN ''B'' ELSE (CASE WHEN iGradeABC = 2 THEN ''C'' ELSE ''D'' END) END) END AS 供应商 FROM Vendor WHERE (cVenCode LIKE ''C%'')' ;
SQL.Open ;
Vendor_CBB.Properties.Items.Clear;
While Not SQL.Eof do
Begin
Vendor_CBB.Properties.Items.Add(SQL.Fields[0].AsString);
SQL.next;
End;
// 读入职员资料
SQL.Close;
SQL.CommandText := 'SELECT cPsn_Num + '' - '' + cPsn_Name AS 人员, cDept_num FROM hr_hi_person WHERE (rPersonType = ''10'') AND (cDept_num = ''03'')' ;
SQL.Open ;
Create_CBB.Properties.Items.Clear;
Person_CBB.Properties.Items.Clear;
While Not SQL.Eof do
Begin
Create_CBB.Properties.Items.Add(SQL.Fields[0].AsString);
Person_CBB.Properties.Items.Add(SQL.Fields[0].AsString);
SQL.next;
End;
// 读入改标资料
SQL.Close;
SQL.CommandText := 'SELECT DISTINCT RIGHT(LEFT(cInvCode, 5), 3) + '' - '' + cLabel AS 品牌,cLabel, cInvDefine6 FROM Inventory WHERE cInvDefine6 = ''自有品牌'' ORDER BY cLabel,cInvDefine6 DESC';
SQL.Open ;
Label_CBB.Properties.Items.Clear;
Label_CBB.Properties.Items.Add('不改标');
While Not SQL.Eof do
Begin
Label_CBB.Properties.Items.Add(SQL.Fields[0].AsString);
SQL.next;
End;
end;
procedure TNewProductForm.CCB_UnitGroupPropertiesChange(Sender: TObject);
begin
SQL.Close;
SQL.CommandText := 'SELECT cComunitCode + '' - '' + cComUnitName AS 单位 FROM ComputationUnit WHERE (cGroupCode = '''+ Copy(UnitGroup_CBB.Text,1,2) +''')' ;
SQL.Open ;
Unit_CBB.Properties.Items.Clear;
While Not SQL.Eof do
Begin
Unit_CBB.Properties.Items.Add(SQL.Fields[0].AsString);
SQL.next;
End;
end;
procedure TNewProductForm.CB_AgreePropertiesChange(Sender: TObject);
begin
IF Agree_CB.Checked = True Then
Agree_CB.Caption := '同意引进'
Else Agree_CB.Caption := '不引进';
end;
procedure TNewProductForm.CCB_VendorPropertiesChange(Sender: TObject);
begin
SQL.Close;
SQL.CommandText := 'SELECT cVenDefine1 AS 日产量,cVenPPerson+ '' - '' + cPsn_Name AS 跟单员 FROM Vendor,hr_hi_person WHERE Vendor.cVenPPerson = hr_hi_person.cPsn_Num AND (cVenCode = '''+ Copy(Vendor_CBB.Text,1,5) +''')' ;
SQL.Open ;
DMakerQty_TE.Text := SQL.Fields[0].AsString ;
Person_CBB.Text := SQL.Fields[1].AsString ;
end;
procedure TNewProductForm.BtnChangeOptionsClick(Sender: TObject);
begin
// 读入引进颜色资料
SQL.Close;
SQL.CommandText := 'SELECT cValue FROM UserDefine WHERE (cID = ''21'') WHERE cValue in ('' + + '') ORDER BY cValue' ;
SQL.Open ;
LoadColor_CCB.Properties.Items.Clear;
While Not SQL.Eof do
Begin
LoadColor_CCB.Properties.Items.AddCheckItem(SQL.Fields[0].AsString,SQL.Fields[0].AsString);
SQL.next;
End;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -