📄 sy_ck_jyp_add.pas
字号:
while not Eof do
begin
cb_BGG.Items.Add(Trim(FieldByName('GBGTMS').AsString));
Next;
end;
{去除包含空的记录}
for i := cb_BGG.Items.Count - 1 downto 0 do
begin
if cb_BGG.Items.Strings[i] = '' then
cb_BGG.Items.Delete(i);
end;
if cb_BGG.Items.Count > 0 then
begin
cb_BGG.ItemIndex := cb_BGG.Items.Count - 1;
VL_Ban_GG := StrToInt(cb_BGG.Text);
end;
end;
end;
{-------------------------------------------------------------------------------}
{面值,售价,结算价以元显示}
procedure TFrm_SY_CK_JYP_Add.qry_PPMZGetText(Sender: TField;
var Text: String; DisplayText: Boolean);
begin
if Trim(Sender.AsString) = '' then
Exit;
try
if Sender.AsInteger <> 0 then
Text := FormatFloat('¥#,##0.00', Sender.AsFloat / 100);
except
end;
end;
{-------------------------------------------------------------------------------}
{调用选择票品模块}
procedure TFrm_SY_CK_JYP_Add.bbtn_SearchClick(Sender: TObject);
var
l_ModalResult: Integer;
begin
(* rg_Type.OnClick := nil;
qry_PP.AfterScroll := nil;
with TFrm_SY_CK_JYP_SearchPP.Create(Application) do
try
Lios_Type := io_txp;
L_index := rg_Type.ItemIndex;
FB_ShowZero := false;
fcb_PPDLB.ItemIndex := rg_Type.ItemIndex;
fcb_PPDLBChange(nil); {刷新小类}
l_ModalResult := ShowModal;
if l_ModalResult = mrOK then
begin
VL_Type := fcb_PPDLB.ItemIndex;
with qry_PP do
begin
Close;
SQL.Text := GetSQL; {由选择票品模块生成的SQL语句}
Open;
end;
end;
finally
Free;
end;
qry_PP.AfterScroll := qry_PPAfterScroll;
rg_Type.ItemIndex := VL_Type;
rg_Type.OnClick := rg_TypeClick;
if l_ModalResult = mrOK then
GetGG(qry_PP.FieldByName('TUDM').AsString); {取得凑整的规格}
*)
with TFrm_SearchPP.Create(Application) do
try
Lios_Type := io_jyp;
// L_index := rg_Type.ItemIndex;
FB_ShowZero := false;
// fcb_PPDLB.ItemIndex := rg_Type.ItemIndex;
fcb_PPDLBChange(nil); {刷新小类}
l_ModalResult := ShowModal;
if l_ModalResult = mrOK then
begin
VL_Type := fcb_PPDLB.ItemIndex;
with qry_PP do
begin
Close;
SQL.Text := GetSQL(True); {由选择票品模块生成的SQL语句}
Open;
end;
end;
finally
Free;
end;
end;
{-------------------------------------------------------------------------------}
{上一步}
procedure TFrm_SY_CK_JYP_Add.bbtn_PriorClick(Sender: TObject);
begin
SetState(0);
end;
{-------------------------------------------------------------------------------}
{下一步}
procedure TFrm_SY_CK_JYP_Add.bbtn_NextClick(Sender: TObject);
begin
if qry_PP.IsEmpty then
begin
Application.MessageBox('必须存在一种票品,才能进行下一步的操作!', '提示', MB_OK + MB_IconInformation);
Exit;
end;
SetState(1); {界面刷新}
rg_CKXZClick(nil); {取分配计划或者分配单}
end;
{-------------------------------------------------------------------------------}
{完成新制定的计划分配单}
procedure TFrm_SY_CK_JYP_Add.bbtn_FinishClick(Sender: TObject);
begin
if qry_DWFP.IsEmpty then
begin
Application.MessageBox('必须根据一种票品的分配方案,才能进行完成分配单的制定!!', '提示', MB_OK + MB_IconInformation);
Exit;
end;
ModalResult := mrOK;
end;
{-------------------------------------------------------------------------------}
{按步处理的界面显示设置}
procedure TFrm_SY_CK_JYP_Add.SetState(A_Style: Integer);
begin
pgc_Select.ActivePageIndex := A_Style;
case a_Style of
0:
begin
bbtn_Search.Visible := True;
bbtn_Prior.Enabled := False;
bbtn_Next.Enabled := True;
bbtn_Finish.Visible := False;
end;
1:
begin
bbtn_Search.Visible := False;
bbtn_Prior.Enabled := True;
bbtn_Next.Enabled := False;
bbtn_Finish.Visible := True;
end;
end;
end;
{-------------------------------------------------------------------------------}
{凑包凑版调用}
procedure TFrm_SY_CK_JYP_Add.SetRounding;
var
l_Dest: Integer;
begin
l_Dest := 0;
case rg_Round.ItemIndex of
0: {凑包} {}
begin
if cb_BZGG.Items.Count = 0 then
begin
Application.MessageBox('包装规格可能不完整,无法按包进行凑整!', '提示', MB_OK + MB_IconInformation);
rg_Round.ItemIndex := 2; {默认为不凑}
Exit;
end;
l_Dest := StrToInt(VL_ZXTS[cb_BZGG.ItemIndex]);
end;
1: {凑版} {}
l_Dest := VL_Ban_GG;
2: {不用凑整数} {}
l_Dest := 0;
end;
SetRoundSL(rg_Round.ItemIndex, rg_Round_Style.ItemIndex, L_Dest); {分配数量的凑整处理}
end;
{-------------------------------------------------------------------------------}
{分配数量的凑整处理}
procedure TFrm_SY_CK_JYP_Add.SetRoundSL(A_Round, A_Round_Style, A_SingleDest: Integer);
{参数说明:凑包方式、凑整的方式(向上、向下)、凑整时的单包或者单版包装规格}
var
l_dbgPlace: TBookMark;
begin
{凑整}
with qry_DWFP do
begin
DisableControls;
First;
l_dbgPlace := GetBookMark;
while not Eof do
begin
Edit;
if A_Round = 2 then {不凑} {}
FieldByName('SL').AsInteger := FieldByName('SL_OLD').AsInteger
else
FieldByName('SL').AsInteger :=
GetRoundNumber(FieldByName('SL_OLD').AsInteger, A_SingleDest, A_Round_Style); {返回凑整后的数据}
Post;
Next;
end;
GotoBookMark(l_dbgPlace);
FreeBookMark(l_dbgPlace);
EnableControls;
end;
end;
{-------------------------------------------------------------------------------}
{返回凑整后的数据}
function TFrm_SY_CK_JYP_Add.GetRoundNumber(A_source, A_SingleDest, A_type: Integer): Integer;
var
l_Mod, l_Div: Integer;
begin
Result := 0;
if A_SingleDest <= 0 then {为0或者小于0时直接返回}
begin
Result := A_Source;
Exit;
end;
l_Mod := A_Source Mod A_SingleDest; {求余数,为0时整除}
if (l_Mod = 0) and (A_Source >= A_SingleDest) then {恰好为整包或整版}
begin
Result := A_Source;
Exit;
end;
l_Div := A_Source Div A_SingleDest; {}
case A_type of
0: {向上} {}
Result := (l_Div + 1) * A_SingleDest;
1: {向下} {}
begin
Result := l_Div * A_SingleDest;
end;
end;
if Result < 0 then {向下取整时为负数时返回0}
Result := 0;
end;
{-------------------------------------------------------------------------------}
procedure TFrm_SY_CK_JYP_Add.cb_BGGChange(Sender: TObject);
begin
VL_Ban_GG := StrToInt(cb_BGG.Text);
SetRounding; {凑包凑版调用}
end;
{-------------------------------------------------------------------------------}
{凑包凑办}
procedure TFrm_SY_CK_JYP_Add.cb_BZGGChange(Sender: TObject);
begin
SetRounding; {凑包凑版调用}
end;
procedure TFrm_SY_CK_JYP_Add.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
VL_ZXTS.Free;
end;
procedure TFrm_SY_CK_JYP_Add.qry_PPSJGetText(Sender: TField;
var Text: String; DisplayText: Boolean);
begin
if Trim(Sender.AsString) = '' then
Exit;
try
if Sender.AsInteger <> 0 then
Text := FormatFloat('¥#,##0.000', Sender.AsFloat / 100);
except
end;
end;
procedure TFrm_SY_CK_JYP_Add.qry_PPSLGetText(Sender: TField;
var Text: String; DisplayText: Boolean);
begin
if Trim(Sender.AsString) = '' then
Exit;
try
if Sender.AsInteger <> 0 then
Text := FormatFloat('#,##0', Sender.AsFloat);
except
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -