D10SZKaiXiYa/B02基础纱线仓库/U_YarnInfoInPut.pas

684 lines
17 KiB
ObjectPascal
Raw Normal View History

2025-03-01 10:55:52 +08:00
unit U_YarnInfoInPut;
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, StdCtrls, ExtCtrls,
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxDateRanges,
dxBarBuiltInMenu, U_BaseInput, U_BaseList, System.ImageList, Vcl.ImgList,
cxContainer, cxMaskEdit, cxMemo, cxImageList, dxSkinsCore,
2025-07-18 15:42:53 +08:00
dxSkinsDefaultPainters, dxCore, cxDateUtils, dxSkinOffice2013White,
2025-11-16 11:44:23 +08:00
dxSkinSharpPlus, dxSkinWXI, dxScrollbarAnnotations, cxCheckBox;
2025-03-01 10:55:52 +08:00
type
TfrmYarnInfoInPut = class(TfrmBaseInput)
ToolBar1: TToolBar;
TBSave: TToolButton;
TBClose: TToolButton;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
ToolButton1: TToolButton;
ScrollBox1: TScrollBox;
Label7: TLabel;
Label1: TLabel;
Y_Name: TcxTextEdit;
Label3: TLabel;
Y_Code: TcxTextEdit;
Label8: TLabel;
Denier: TcxTextEdit;
Label9: TLabel;
Note: TcxMemo;
Label5: TLabel;
ADOConnection1: TADOConnection;
Label10: TLabel;
FF: TcxTextEdit;
2025-03-26 14:10:41 +08:00
Label12: TLabel;
ZS: TcxTextEdit;
Y_Color: TcxButtonEdit;
Y_Composition: TcxButtonEdit;
2025-08-12 13:37:49 +08:00
Label16: TLabel;
2025-11-16 11:44:23 +08:00
ToolBar2: TToolBar;
TbAdd: TToolButton;
TbDel: TToolButton;
Tv1: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
cxGrid1: TcxGrid;
Tv1DH: TcxGridDBColumn;
Tv1CF: TcxGridDBColumn;
Tv1BL: TcxGridDBColumn;
CDS_1: TClientDataSet;
DS_1: TDataSource;
Tv1serialno: TcxGridDBColumn;
Tv1CFID: TcxGridDBColumn;
Tv1BYIID: TcxGridDBColumn;
2026-02-06 16:53:43 +08:00
Tv1VieName: TcxGridDBColumn;
Tv1Column1: TcxGridDBColumn;
Label2: TLabel;
2025-03-01 10:55:52 +08:00
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TBSaveClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
2025-03-26 14:10:41 +08:00
procedure Y_NameClick(Sender: TObject);
procedure Y_NameExit(Sender: TObject);
procedure Y_SpecPropertiesChange(Sender: TObject);
procedure DenierClick(Sender: TObject);
procedure DenierExit(Sender: TObject);
procedure ZSClick(Sender: TObject);
procedure ZSExit(Sender: TObject);
procedure DenierPropertiesEditValueChanged(Sender: TObject);
procedure ZSPropertiesEditValueChanged(Sender: TObject);
procedure ParentCoNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure Y_ColorDblClick(Sender: TObject);
2025-04-23 15:09:48 +08:00
procedure CJPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
2025-05-19 15:46:55 +08:00
procedure CJPropertiesChange(Sender: TObject);
2025-11-16 11:44:23 +08:00
procedure TbAddClick(Sender: TObject);
procedure TbDelClick(Sender: TObject);
procedure TextEdit(Sender: TObject);
2026-02-06 16:53:43 +08:00
procedure FFPropertiesChange(Sender: TObject);
procedure Y_ColorPropertiesChange(Sender: TObject);
procedure ZSPropertiesChange(Sender: TObject);
2025-03-01 10:55:52 +08:00
private
{ Private declarations }
function SaveData(): Boolean;
2025-05-19 15:46:55 +08:00
procedure UpdateYarnName;
2025-11-16 11:44:23 +08:00
procedure initCFGrid();
2026-01-14 17:32:54 +08:00
function CheckBL(): Boolean;
2025-03-01 10:55:52 +08:00
public
{ Public declarations }
FBYIID, FSTKName: string;
end;
var
frmYarnInfoInPut: TfrmYarnInfoInPut;
implementation
uses
2025-11-16 11:44:23 +08:00
U_DataLink, U_RTFun, U_ZDYHelp, U_CompanySel, U_YarnCFInfoSel; //, U_ProductInfoSel
2025-03-01 10:55:52 +08:00
{$R *.dfm}
2025-04-23 15:09:48 +08:00
procedure TfrmYarnInfoInPut.CJPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmCompanySel := TfrmCompanySel.Create(Application);
with frmCompanySel do
begin
FCoType := '<27><>Ӧ<EFBFBD><D3A6>';
if ShowModal = 1 then
begin
2025-11-16 11:44:23 +08:00
2025-04-23 15:09:48 +08:00
end;
end;
finally
frmCompanySel.Free;
end;
end;
2025-05-19 15:46:55 +08:00
procedure TfrmYarnInfoInPut.CJPropertiesChange(Sender: TObject);
begin
UpdateYarnName;
end;
2025-03-26 14:10:41 +08:00
procedure TfrmYarnInfoInPut.DenierClick(Sender: TObject);
begin
ZS.Style.Color := clMoneyGreen;
end;
procedure TfrmYarnInfoInPut.DenierExit(Sender: TObject);
begin
ZS.Style.Color := clWhite;
end;
procedure TfrmYarnInfoInPut.DenierPropertiesEditValueChanged(Sender: TObject);
begin
2025-04-23 15:09:48 +08:00
ZS.text := floattostr(roundfloat(5315.5 / strtofloatdef(Denier.text, 0), 0));
2025-03-26 14:10:41 +08:00
end;
2026-02-06 16:53:43 +08:00
procedure TfrmYarnInfoInPut.FFPropertiesChange(Sender: TObject);
2025-05-19 15:46:55 +08:00
begin
2026-02-06 16:53:43 +08:00
2025-05-19 15:46:55 +08:00
UpdateYarnName;
end;
2025-03-01 10:55:52 +08:00
procedure TfrmYarnInfoInPut.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
Action := caFree;
end;
2025-11-16 11:44:23 +08:00
procedure TfrmYarnInfoInPut.initCFGrid();
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select A.* from BS_Yarn_Info_CF A ');
sql.Add(' where BYIID = ' + quotedStr(Trim(FBYIID)));
sql.Add('Order By A.serialno ');
Open;
end;
SCreateCDS(ADOQueryTemp, CDS_1);
SInitCDSData(ADOQueryTemp, CDS_1);
end;
2025-03-01 10:55:52 +08:00
function TfrmYarnInfoInPut.SaveData(): Boolean;
var
2025-11-16 11:44:23 +08:00
MaxNo, MaxPRID, maxCFID: string;
2025-03-01 10:55:52 +08:00
begin
try
ADOQueryCmd.Connection.BeginTrans;
if Trim(FBYIID) = '' then
begin
if GetLSNo(ADOQueryCmd, MaxNo, 'P', 'BS_Yarn_Info', 4, 0) = False then
raise Exception.Create(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
Y_Code.Text := MaxNo;
end
else
begin
MaxNo := Trim(FBYIID);
end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from BS_Yarn_Info where BYIID=''' + Trim(MaxNo) + '''');
Open;
end;
with ADOQueryCmd do
begin
if Trim(FBYIID) = '' 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(ADOQueryTemp);
end;
FieldByName('BYIID').Value := Trim(MaxNo);
RTSetsavedata(ADOQueryCmd, 'BS_Yarn_Info', ScrollBox1, 2);
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from BS_Yarn_Info where Y_Code=' + quotedstr(trim(Y_Code.Text)));
Open;
end;
if ADOQueryCmd.RecordCount > 1 then
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>!');
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from BS_Yarn_Info where Y_Name=' + quotedstr(trim(Y_Name.Text)));
Open;
end;
if ADOQueryCmd.RecordCount > 1 then
raise Exception.Create('Ʒ<><C6B7><EFBFBD>ظ<EFBFBD>!');
2025-11-16 11:44:23 +08:00
////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ɷֱ<C9B7><D6B1><EFBFBD>ʼ //////////////////////
with CDS_1 do
begin
First;
while not Eof do
begin
if Trim(CDS_1.fieldbyname('CFID').AsString) = '' then
begin
if GetLSNo(ADOQueryTemp, maxCFID, 'CF', 'BS_Yarn_Info_CF', 5, 1) = False then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
maxCFID := Trim(CDS_1.fieldbyname('CFID').AsString);
end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from BS_Yarn_Info_CF where ');
sql.Add(' CFID=''' + Trim(maxCFID) + '''');
Open;
end;
with ADOQueryCmd do
begin
if Trim(CDS_1.fieldbyname('BYIID').AsString) = '' then
begin
Append;
end
else
begin
Edit;
end;
FieldByName('Y_Code').Value := Y_Code.Text;
FieldByName('BYIID').Value := Trim(MaxNo);
FieldByName('CFID').Value := Trim(maxCFID);
RTSetSaveDataCDS(ADOQueryCmd, Tv1, CDS_1, 'BS_Yarn_Info_CF', 0);
Post;
end;
Next;
end;
end;
//////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><C9B7>ӱ<EFBFBD><D3B1><EFBFBD><EFBFBD><EFBFBD> //////////////////////
2025-03-01 10:55:52 +08:00
ADOQueryCmd.Connection.CommitTrans;
Result := True;
except
Result := False;
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
2025-11-16 11:44:23 +08:00
procedure TfrmYarnInfoInPut.TbAddClick(Sender: TObject);
begin
try
frmYarnCFInfoSel := TfrmYarnCFInfoSel.Create(Application);
with frmYarnCFInfoSel do
begin
if ShowModal = 1 then
begin
frmYarnCFInfoSel.CDS_1.First;
while not frmYarnCFInfoSel.CDS_1.Eof do
begin
if frmYarnCFInfoSel.CDS_1.FieldByName('SSel').Value = true then
begin
with Self.CDS_1 do
begin
Append;
FieldByName('DH').Value := frmYarnCFInfoSel.CDS_1.fieldbyname('DH').value;
FieldByName('CF').Value := frmYarnCFInfoSel.CDS_1.fieldbyname('CF').value;
2026-02-06 16:53:43 +08:00
FieldByName('CHNName').Value := frmYarnCFInfoSel.CDS_1.fieldbyname('CHNName').value;
FieldByName('VieName').Value := frmYarnCFInfoSel.CDS_1.fieldbyname('VieName').value;
2025-11-16 11:44:23 +08:00
FieldByName('serialno').Value := Self.CDS_1.RecordCount + 1;
Post;
end;
end;
frmYarnCFInfoSel.CDS_1.Next;
end;
end;
end;
finally
frmYarnCFInfoSel.Free;
end;
end;
procedure TfrmYarnInfoInPut.TbDelClick(Sender: TObject);
var
i: Integer;
begin
if not CDS_1.IsEmpty then
begin
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) = IDYES then
begin
if Trim(CDS_1.fieldbyname('CFID').AsString) <> '' then
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete BS_Yarn_Info_CF where CFID=' + quotedStr(Trim(CDS_1.fieldbyname('CFID').AsString)));
ExecSQL;
end;
end;
CDS_1.Delete;
end
else
exit;
i := 0;
CDS_1.First;
while not CDS_1.Eof do
begin
i := i + 1;
CDS_1.Edit;
CDS_1.fieldByName('serialno').value := i;
CDS_1.Post;
CDS_1.Next;
end;
end
else
begin
Application.MessageBox('<27>޿<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end;
2025-03-01 10:55:52 +08:00
procedure TfrmYarnInfoInPut.TBCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmYarnInfoInPut.FormCreate(Sender: TObject);
begin
inherited;
try
with ADOConnection1 do
begin
Connected := false;
ConnectionString := DConString;
Connected := true;
end;
ADOQueryBaseCmd.Connection := ADOConnection1;
ADOQueryBaseTemp.Connection := ADOConnection1;
except
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
end;
end;
procedure TfrmYarnInfoInPut.FormShow(Sender: TObject);
var
fsj: string;
begin
inherited;
2025-03-26 14:10:41 +08:00
// fsj := ' select Code=ZDYNo,Name=ZDYName from KH_ZDY where Type=''YType'' and MainType=''ɴ<>ߵ<EFBFBD><DFB5><EFBFBD>'' ';
// SInitTcxComBoxBySql(ADOQueryTemp, Y_Type, false, fsj);
//
// fsj := ' select Code=ZDYNo,Name=ZDYName from KH_ZDY where Type=''Y_Spec'' and MainType=''ɴ<>ߵ<EFBFBD><DFB5><EFBFBD>'' ';
// SInitTcxComBoxBySql(ADOQueryTemp, Y_Spec, false, fsj);
//
// fsj := ' select Code=ZDYNo,Name=ZDYName from KH_ZDY where Type=''Y_Composition'' and MainType=''ɴ<>ߵ<EFBFBD><DFB5><EFBFBD>'' ';
// SInitTcxComBoxBySql(ADOQueryTemp, Y_Composition, false, fsj);
//
// fsj := ' select Code=ZDYNo,Name=ZDYName from KH_ZDY where Type=''Y_Color'' and MainType=''ɴ<>ߵ<EFBFBD><DFB5><EFBFBD>'' ';
// SInitTcxComBoxBySql(ADOQueryTemp, Y_Color, false, fsj);
2026-02-06 16:53:43 +08:00
initCFGrid();
2025-03-01 10:55:52 +08:00
with ADOQueryTemp do
begin
Close;
SQL.Clear;
sql.Add(' select * from BS_Yarn_Info ');
sql.Add(' where BYIID=''' + Trim(FBYIID) + '''');
Open;
end;
SCSHData(ADOQueryTemp, ScrollBox1, 2);
2026-02-06 16:53:43 +08:00
// initCFGrid();
2025-11-16 11:44:23 +08:00
2025-03-26 14:10:41 +08:00
if FBYIID = '' then
begin
2025-11-16 11:44:23 +08:00
2025-03-26 14:10:41 +08:00
end;
end;
procedure TfrmYarnInfoInPut.Y_ColorDblClick(Sender: TObject);
begin
TcxButtonEdit(Sender).Text := '';
TcxButtonEdit(Sender).Properties.LookupItems.Text := '';
end;
2026-02-06 16:53:43 +08:00
procedure TfrmYarnInfoInPut.Y_ColorPropertiesChange(Sender: TObject);
2025-05-19 15:46:55 +08:00
begin
UpdateYarnName;
end;
2025-03-26 14:10:41 +08:00
procedure TfrmYarnInfoInPut.ParentCoNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
var
fsj: string;
FWZ: Integer;
begin
fsj := Trim(TcxButtonEdit(Sender).Hint);
FWZ := Pos('/', fsj);
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
2025-04-17 15:21:14 +08:00
MainType := <>ߵ<EFBFBD><DFB5><EFBFBD>';
2025-03-26 14:10:41 +08:00
flag := Copy(fsj, 1, FWZ - 1);
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
if ShowModal = 1 then
begin
TcxButtonEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
2025-03-01 10:55:52 +08:00
end;
procedure TfrmYarnInfoInPut.TBSaveClick(Sender: TObject);
begin
// if Trim(Y_Code.Text) = '' then
// begin
// Application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
// Exit;
// end;
2025-04-23 15:09:48 +08:00
ToolBar1.SetFocus;
2025-05-19 17:31:51 +08:00
Y_Name.text := Trim(Y_Composition.text) + Trim(ZS.text) + 'S' + Trim(Y_Color.text) + Trim(FF.text); //+ Trim(CJ.text)
2025-03-01 10:55:52 +08:00
if Trim(Y_Name.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
2025-03-26 14:10:41 +08:00
2025-03-01 10:55:52 +08:00
if Trim(Denier.Text) <> '' then
begin
if StrToFloatdef(Denier.Text, 0) = 0 then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD>D<EFBFBD><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end;
2026-02-06 16:53:43 +08:00
if CDS_1.IsEmpty then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɴ<EFBFBD><C9B4>ԭ<EFBFBD><D4AD>!', '<27><>ʾ', 0);
Exit;
end;
2026-01-14 17:32:54 +08:00
if not CheckBL() then
begin
Exit;
end;
2025-03-01 10:55:52 +08:00
if SaveData() then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
ModalResult := 1;
Exit;
end;
end;
2025-11-16 11:44:23 +08:00
procedure TfrmYarnInfoInPut.TextEdit(Sender: TObject);
var
s: string;
fValue: Double;
begin
s := TcxTextEdit(Sender).EditingText;
if (s <> '') and (s[Length(s)] <> '%') then
begin
try
// <20><><EFBFBD>Խ<EFBFBD><D4BD>ַ<EFBFBD><D6B7><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
fValue := StrToFloat(s);
2026-01-14 17:32:54 +08:00
// if fValue < 0 then
// begin
// s := '0';
// end;
// if fValue > 100 then
// begin
// s := '100';
// end;
2025-11-16 11:44:23 +08:00
// <20><>ʽ<EFBFBD><CABD>Ϊ<EFBFBD><CEAA>λС<CEBB><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӱٷֺ<D9B7>
2025-12-09 17:30:17 +08:00
// Tv1.Controller.FocusedColumn.EditValue := FormatFloat('0.00', fValue) + '%';
Tv1.Controller.FocusedColumn.EditValue := s + '%';
Y_Composition.Text := '';
2026-02-06 16:53:43 +08:00
Y_Name.Text := '';
2025-12-09 17:30:17 +08:00
CDS_1.First;
while not CDS_1.Eof do
begin
if Y_Composition.Text = '' then
begin
Y_Composition.Text := CDS_1.FieldByName('BL').AsString + CDS_1.FieldByName('CF').AsString;
end
else
begin
Y_Composition.Text := Y_Composition.Text + ' ' + CDS_1.FieldByName('BL').AsString + CDS_1.FieldByName('CF').AsString;
end;
2026-02-06 16:53:43 +08:00
if Y_Name.Text = '' then
begin
Y_Name.Text := CDS_1.FieldByName('BL').AsString + CDS_1.FieldByName('DH').AsString;
end
else
begin
Y_Name.Text := Y_Name.Text + ' ' + CDS_1.FieldByName('BL').AsString + CDS_1.FieldByName('DH').AsString;
end;
2025-12-09 17:30:17 +08:00
CDS_1.Next;
end;
2026-02-06 16:53:43 +08:00
Y_Name.Text := Trim(Y_Name.Text) + Trim(ZS.Text) + 'S' + Trim(Y_Color.Text) + Trim(FF.Text);
2025-11-16 11:44:23 +08:00
except
on E: EConvertError do
begin
// <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӱٷֺ<D9B7>
Tv1.Controller.FocusedColumn.EditValue := s + '%';
end;
end;
end;
end;
2026-01-14 17:32:54 +08:00
function TfrmYarnInfoInPut.CheckBL(): Boolean;
var
mBL: Double;
msubBL: Double;
begin
Result := False;
msubBL := 0;
CDS_1.First;
while not CDS_1.Eof do
begin
// һ<>д<EFBFBD><D0B4><EFBFBD><EBB4A6><EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD>%<25>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
if not TryStrToFloat(StringReplace(CDS_1.FieldByName('BL').AsString, '%', '', [rfReplaceAll]), mBL) then
begin
ShowMessage('<27><><EFBFBD><EFBFBD> ' + CDS_1.FieldByName('DH').AsString + ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>');
Exit;
end
else
begin
msubBL := msubBL + mBL;
end;
if (mBL <= 0) or (mBL > 100) then
begin
ShowMessage('<27><><EFBFBD><EFBFBD> ' + CDS_1.FieldByName('DH').AsString + ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0-100% ֮<><D6AE>');
Exit;
end;
CDS_1.Next;
end;
if msubBL > 100 then
begin
ShowMessage('<27><><EFBFBD><EFBFBD>֮<EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD><EFBFBD><EFBFBD> 0-100% ֮<><D6AE>');
Exit;
end;
Result := True;
end;
2025-03-26 14:10:41 +08:00
procedure TfrmYarnInfoInPut.Y_NameClick(Sender: TObject);
begin
Y_Composition.Style.Color := clMoneyGreen;
2025-04-23 15:09:48 +08:00
ZS.Style.Color := clMoneyGreen;
2025-03-26 14:10:41 +08:00
Y_Color.Style.Color := clMoneyGreen;
2025-04-23 15:09:48 +08:00
FF.Style.Color := clMoneyGreen;
2025-05-19 17:31:51 +08:00
// CJ.Style.Color := clMoneyGreen;
2025-03-26 14:10:41 +08:00
end;
procedure TfrmYarnInfoInPut.Y_NameExit(Sender: TObject);
begin
Y_Composition.Style.Color := clWhite;
2025-04-23 15:09:48 +08:00
ZS.Style.Color := clWhite;
2025-03-26 14:10:41 +08:00
Y_Color.Style.Color := clWhite;
2025-04-23 15:09:48 +08:00
FF.Style.Color := clWhite;
2025-05-19 17:31:51 +08:00
// CJ.Style.Color := clWhite;
2025-03-26 14:10:41 +08:00
end;
procedure TfrmYarnInfoInPut.Y_SpecPropertiesChange(Sender: TObject);
begin
2025-05-19 17:31:51 +08:00
Y_Name.text := Trim(Y_Composition.text) + Trim(ZS.text) + 'S' + Trim(Y_Color.text) + Trim(FF.text); //+ Trim(CJ.text)
2025-03-26 14:10:41 +08:00
end;
procedure TfrmYarnInfoInPut.ZSClick(Sender: TObject);
begin
Denier.Style.Color := clMoneyGreen;
end;
procedure TfrmYarnInfoInPut.ZSExit(Sender: TObject);
begin
Denier.Style.Color := clWhite;
end;
2025-05-19 15:46:55 +08:00
procedure TfrmYarnInfoInPut.ZSPropertiesChange(Sender: TObject);
begin
2026-02-06 16:53:43 +08:00
2025-05-19 15:46:55 +08:00
UpdateYarnName;
end;
2025-05-19 17:31:51 +08:00
2025-03-26 14:10:41 +08:00
procedure TfrmYarnInfoInPut.ZSPropertiesEditValueChanged(Sender: TObject);
begin
2025-04-23 15:09:48 +08:00
Denier.text := floattostr(roundfloat(5315.5 / strtofloatdef(ZS.text, 0), 0));
2026-02-06 16:53:43 +08:00
2025-03-26 14:10:41 +08:00
end;
2025-05-19 15:46:55 +08:00
procedure TfrmYarnInfoInPut.UpdateYarnName;
begin
2026-02-06 16:53:43 +08:00
Y_Name.Text := '';
CDS_1.First;
while not CDS_1.Eof do
begin
if Y_Name.Text = '' then
begin
Y_Name.Text := CDS_1.FieldByName('BL').AsString + CDS_1.FieldByName('DH').AsString;
end
else
begin
Y_Name.Text := Y_Name.Text + ' ' + CDS_1.FieldByName('BL').AsString + CDS_1.FieldByName('DH').AsString;
end;
CDS_1.Next;
end;
Y_Name.Text := Trim(Y_Name.Text) + Trim(ZS.Text) + 'S' + Trim(Y_Color.Text) + Trim(FF.Text);
2025-05-19 15:46:55 +08:00
end;
2025-03-01 10:55:52 +08:00
end.