📄 newproductunit.pas
字号:
unit NewProductUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxGraphics, DB, ADODB, cxCheckComboBox, cxDBCheckComboBox,
cxDropDownEdit, cxCalendar, cxCheckBox, cxLabel, cxTextEdit, cxControls,
cxContainer, cxEdit, cxMaskEdit, cxLookupEdit, cxDBLookupEdit,ComCtrls,
cxDBLookupComboBox, StdCtrls, RzCmboBx, ExtCtrls, RzPanel, RzLabel, Mask,
RzEdit, cxSpinEdit, RzButton, RzPrgres;
type
TfrmNewProduct = class(TForm)
DS_Inventory: TDataSource;
DataInventory: TADODataSet;
RzLabel5: TRzLabel;
RzPanel1: TRzPanel;
RzGroupBox1: TRzGroupBox;
TypeList: TcxComboBox;
RzGroupBox2: TRzGroupBox;
bMyLabel: TCheckBox;
InvID: TcxTextEdit;
Label_ProductNumber: TcxLabel;
Label_ProductCodeLabel: TcxLabel;
InvCode: TcxTextEdit;
InvName: TcxTextEdit;
LabelList: TcxComboBox;
RzGroupBox3: TRzGroupBox;
bVendor: TcxCheckBox;
Label_SupplyPrice: TcxLabel;
BuyPrice: TcxTextEdit;
VenList: TcxComboBox;
RzGroupBox4: TRzGroupBox;
Label_SalePrice: TcxLabel;
SalePrice: TcxTextEdit;
WXPriceLabel: TcxLabel;
WXPrice: TcxTextEdit;
cxLabel1: TcxLabel;
LSPrice: TcxTextEdit;
RzGroupBox5: TRzGroupBox;
Label_NewDate: TcxLabel;
Label_UnitGroup: TcxLabel;
cxLabel2: TcxLabel;
cxLabel3: TcxLabel;
cxLabel4: TcxLabel;
cxLabel5: TcxLabel;
cxLabel6: TcxLabel;
cxLabel7: TcxLabel;
cxLabel8: TcxLabel;
cxLabel9: TcxLabel;
bControl: TCheckBox;
dStartDate: TRzDateTimeEdit;
ColorList: TcxCheckComboBox;
SizeList: TcxCheckComboBox;
UnitList: TcxComboBox;
RzGroupBox6: TRzGroupBox;
Label_CustQTY: TcxLabel;
Label_PlanMemo: TcxLabel;
TE_PlanMemo: TcxTextEdit;
PlanCust: TcxSpinEdit;
RzToolbar1: TRzToolbar;
BtnNew: TRzToolButton;
BtnEdit: TRzToolButton;
BtnQuery: TRzToolButton;
RzSpacer1: TRzSpacer;
BtnOK: TRzToolButton;
BtnCancel: TRzToolButton;
cxLabel10: TcxLabel;
CheckBox1: TCheckBox;
SouName: TcxTextEdit;
cxLabel11: TcxLabel;
InvType1: TcxComboBox;
InvType2: TcxComboBox;
InvType3: TcxComboBox;
InvType4: TcxComboBox;
InvType5: TcxComboBox;
InvType6: TcxComboBox;
RzGroupBox7: TRzGroupBox;
cbProdData: TcxCheckBox;
cbColorSize: TcxCheckBox;
cbVenPrice: TcxCheckBox;
cbSalePlan: TcxCheckBox;
cbBarCode: TcxCheckBox;
cbLSData: TcxCheckBox;
cbLSupdate: TcxCheckBox;
cbInvPrice: TcxCheckBox;
RzStatusBar1: TRzStatusBar;
RzProgressBar1: TRzProgressBar;
RzMemo1: TRzMemo;
cxLabel12: TcxLabel;
STPrice: TcxTextEdit;
procedure MarkcInvCode;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure LabelListExit(Sender: TObject);
procedure TypeListExit(Sender: TObject);
procedure BtnNewClick(Sender: TObject);
procedure BtnEditClick(Sender: TObject);
procedure BtnOKClick(Sender: TObject);
procedure BtnCancelClick(Sender: TObject);
procedure BtnQueryClick(Sender: TObject);
procedure InvType1PropertiesChange(Sender: TObject);
procedure InvType2PropertiesChange(Sender: TObject);
procedure InvType3PropertiesChange(Sender: TObject);
procedure InvNamePropertiesChange(Sender: TObject);
procedure InvIDExit(Sender: TObject);
procedure Label_ProductCodeLabelClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmNewProduct: TfrmNewProduct;
Sqltext,Termtext: String;
i,iState: Integer;
implementation
uses
DataUnit , PublicUnit, MainUnit ,LoginUnit;
{$R *.dfm}
procedure TfrmNewProduct.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
if MessageDlg('提示: '+#13+'即将关闭窗口,是否更新颜色尺码数据及同步零售系统相关数据?: '+#13+#13+#13,mtInformation,[mbOK,mbCancel],0) = mrOk Then begin
try
With dm.sql do begin
CommandText := 'ExeCute _PM_P_BarCode_Update ';
execute;
CommandText := 'ExeCute _PM_P_LSserver_Update ';
execute;
end;
Showmessage('更新成功! ');
except
Showmessage('更新失败,关闭窗口! ');
end;
end;
Action:=caFree;
end;
procedure TfrmNewProduct.FormShow(Sender: TObject);
begin
dStartDate.Date:= Now();
Sqltext :='select cInvCCode+'' - ''+cInvCName FROM InventoryClass WHERE (bInvCEnd = 1) ORDER BY cInvCCode';
TypeList.Properties.Items.Clear ;
TypeList.Properties.Items.AddStrings(GetList(Sqltext));
Sqltext :='SELECT cGroupCode+'' - ''+cGroupName FROM ComputationGroup WHERE (cGroupCode <> ''01'')';
UnitList.Properties.Items.Clear ;
UnitList.Properties.Items.AddStrings(GetList(Sqltext));
end;
procedure TfrmNewProduct.LabelListExit(Sender: TObject);
begin
If LabelList.Text <> '' Then begin
IF bVendor.Checked=True Then begin
Termtext := Copy(LabelList.Text,1,pos('-',LabelList.Text) -2 );
Sqltext :='SELECT cVenName +'' - ''+ cVenCode FROM Vendor WHERE (cVenCode IN (Select cVenCode FROM Inventory WHERE (cLabel = '''+Termtext+''')))';
VenList.Properties.Items.Clear ;
VenList.Properties.Items.AddStrings(GetList(Sqltext));
end else begin
Sqltext :='SELECT cVenName +'' - ''+ cVenCode FROM Vendor ORDER BY cVenName';
VenList.Properties.Items.Clear ;
VenList.Properties.Items.AddStrings(GetList(Sqltext));
end;
end ;
InvCode.Text := '' ;
UnitList.Text := '' ;
end;
procedure TfrmNewProduct.TypeListExit(Sender: TObject);
var
i:integer;
begin
If TypeList.Text <> '' Then begin
//读入品牌资料
Sqltext :='SELECT DISTINCT cLabel+'' - ''+dbo._PM_F_Getpy(cLabel) a FROM Inventory WHERE (cInvCCode = '''+Lefts(Typelist.Text)+''') ORDER BY a';
LabelList.Properties.Items.Clear ;
LabelList.Properties.Items.AddStrings(GetList(Sqltext));
Sqltext :='SELECT TOP 1 cEcoCode FROM InventoryClass WHERE (cInvCCode = '''+Lefts(Typelist.Text)+''') AND (cEcoCode=''1'')';
IF GetList(Sqltext).Count=0 Then bControl.Checked:= False Else bControl.Checked:=True;
//读入尺码资料
Termtext := '(cAlias>''6ZZ'') AND ';
IF Pos('80',TypeList.Text)<>0 Then Termtext:='((cAlias<''2ZZ'') OR (cAlias=''998'') OR (cAlias=''999'')) AND ';
IF Pos('11',TypeList.Text)<>0 Then Termtext:=' (cAlias<''6ZZ'') AND ';
Sqltext :='SELECT cValue,cBarCode FROM UserDefine WHERE '+Termtext+' (cID = ''21'') ORDER BY cAlias';
SizeList.Properties.Items.Clear ;
For i := 0 TO GetList(Sqltext).Count -1 do begin
SizeList.Properties.Items.AddCheckItem(GetList(Sqltext).Strings[i]);
end;
//读入颜色资料
IF Copy(TypeList.Text,1,1)='1' Then Termtext := '3' Else Termtext := '2';
Sqltext :='SELECT DISTINCT ColorSize.sColor, COUNT_BIG (ColorSize.sColor) FROM ColorSize RIGHT OUTER JOIN UserDefine ON ColorSize.sColor = UserDefine.cValue GROUP BY ColorSize.sColor, UserDefine.cID,cBarCode HAVING (LEN(cBarCode) = '''+Termtext+''') AND (ColorSize.sColor <> ''Z_指定色'') AND (UserDefine.cID = ''20'') ORDER BY COUNT_BIG (ColorSize.sColor) DESC';
ColorList.Properties.Items.Clear ;
For i := 0 TO GetList(Sqltext).Count -1 do begin
ColorList.Properties.Items.AddCheckItem(GetList(Sqltext).Strings[i]);
end;
InvCode.Text := '' ;
UnitList.Text := '' ;
end ;
end;
procedure TfrmNewProduct.MarkcInvCode;
Var
cInvID:String;
begin
IF ((TypeList.Text <> '') AND (LabelList.Text <> '') AND (InvID.Text <> '')) Then begin
cInvID := InvID.Text ;
While Length(cInvID) < 5 do
Begin
cInvID := cInvID + '0'
end;
InvCode.Hint:= Copy(Lefts(TypeList.Text),Length(Lefts(TypeList.Text))-1,2)+Rights(LabelList.Text)+ Copy(cInvID,1,5);
InvName.Text:= Lefts(LabelList.Text)+'/'+InvID.Text+Rights(TypeList.Text);
end;
while GetList('select cInvCode from inventory where cinvcode ='''+InvCode.Hint +'''').Count >0 do begin
InvCode.Hint := Copy(InvCode.Hint,1,Length(InvCode.Hint)-1) + IntToStr(StrToInt(Copy(InvCode.Hint,Length(InvCode.Hint),1))+1);
InvName.Text:= Lefts(LabelList.Text)+'/'+InvID.Text+Rights(TypeList.Text)+' [货品重复]';
end;
InvCode.Text:= InvCode.Hint
end;
procedure TfrmNewProduct.BtnNewClick(Sender: TObject);
begin
iState:=0;
RzPanel1.Enabled := True ;
BtnNew.Enabled := False ;
BtnEdit.Enabled := False ;
BtnQuery.Enabled := False ;
BtnOK.Enabled := True ;
BtnCancel.Enabled := True ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -