检验
This commit is contained in:
parent
673a3c47b3
commit
735af91a7c
|
|
@ -127,7 +127,6 @@ inherited frmTatClothInspList: TfrmTatClothInspList
|
|||
ParentFont = False
|
||||
PopupMenu = PM_1
|
||||
TabOrder = 2
|
||||
ExplicitTop = 133
|
||||
object Tv1: TcxGridDBTableView
|
||||
OnMouseUp = Tv1MouseUp
|
||||
Navigator.Buttons.CustomButtons = <>
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ object frmTatInspEdit: TfrmTatInspEdit
|
|||
Width = 24
|
||||
Height = 12
|
||||
Caption = #27611#37325
|
||||
Visible = False
|
||||
end
|
||||
object Label6: TLabel
|
||||
Left = 343
|
||||
|
|
@ -159,6 +160,7 @@ object frmTatInspEdit: TfrmTatInspEdit
|
|||
Width = 12
|
||||
Height = 12
|
||||
Caption = 'Kg'
|
||||
Visible = False
|
||||
end
|
||||
object Label12: TLabel
|
||||
Left = 459
|
||||
|
|
@ -222,7 +224,7 @@ object frmTatInspEdit: TfrmTatInspEdit
|
|||
Width = 54
|
||||
Height = 20
|
||||
TabOrder = 4
|
||||
OnChange = GrossWeightChange
|
||||
Visible = False
|
||||
end
|
||||
object Meter: TEdit
|
||||
Left = 373
|
||||
|
|
@ -257,6 +259,7 @@ object frmTatInspEdit: TfrmTatInspEdit
|
|||
Width = 54
|
||||
Height = 20
|
||||
TabOrder = 5
|
||||
OnChange = NetWeightChange
|
||||
end
|
||||
object PieceNo: TEdit
|
||||
Left = 261
|
||||
|
|
|
|||
|
|
@ -72,15 +72,16 @@ type
|
|||
procedure ToolButton4Click(Sender: TObject);
|
||||
procedure cxGridDBColumn3PropertiesEditValueChanged(Sender: TObject);
|
||||
procedure TV1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||||
procedure GrossWeightChange(Sender: TObject);
|
||||
procedure NetWeightChange(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
FGramW: Double;
|
||||
FAddW: Double; //加载时的加重快照,保存时从界面毛净重中扣回
|
||||
FAddL: Double; //加载时的加长快照,保存时从界面米数中扣回
|
||||
FSyncing: Boolean; //加载赋值时防止OnChange重入
|
||||
function SaveData(): Boolean;
|
||||
procedure GetJYXK(FJYIP: string);
|
||||
procedure UpdateCalcMeter();
|
||||
function RoundUpToHalf(AValue: Double): Double; //decimal 0.1-0.4 -> 0.5, 0.6-0.9 -> next integer
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
|
@ -114,15 +115,23 @@ begin
|
|||
end;
|
||||
PieceNo.Text := Trim(ADOTmp.fieldbyname('PieceNo').AsString);
|
||||
|
||||
//gram weight snapshot first, GrossWeight OnChange recalcs CalcMeter with it
|
||||
//gram weight snapshot first, NetWeight OnChange recalcs CalcMeter with it
|
||||
FGramW := StrToFloatdef(Trim(ADOTmp.fieldbyname('C_GramWeight').AsString), 0);
|
||||
//加重快照:界面显示含加重的毛净重,保存时再扣回,保证数据库基础字段口径不变
|
||||
FAddW := StrToFloatdef(Trim(ADOTmp.fieldbyname('add_weight').AsString), 0);
|
||||
|
||||
GrossWeight.Text := FormatFloat('0.##', StrToFloatdef(Trim(ADOTmp.fieldbyname('GrossWeight').AsString), 0) + FAddW);
|
||||
NetWeight.Text := FormatFloat('0.##', StrToFloatdef(Trim(ADOTmp.fieldbyname('NetWeight').AsString), 0) + FAddW);
|
||||
Meter.Text := Trim(ADOTmp.fieldbyname('Meter').AsString);
|
||||
Yardage.Text := Trim(ADOTmp.fieldbyname('Yardage').AsString);
|
||||
//加长快照:界面米数含加长显示,保存时再扣回,与检验页 Meter+add_length 口径一致
|
||||
FAddL := StrToFloatdef(Trim(ADOTmp.fieldbyname('add_length').AsString), 0);
|
||||
FSyncing := True;
|
||||
try
|
||||
GrossWeight.Text := FormatFloat('0.##', StrToFloatdef(Trim(ADOTmp.fieldbyname('GrossWeight').AsString), 0) + FAddW);
|
||||
NetWeight.Text := FormatFloat('0.##', StrToFloatdef(Trim(ADOTmp.fieldbyname('NetWeight').AsString), 0) + FAddW);
|
||||
//毛重框已隐藏:毛重与净重保持一致,净重为唯一录入位
|
||||
GrossWeight.Text := NetWeight.Text;
|
||||
Meter.Text := FormatFloat('0.##', StrToFloatdef(Trim(ADOTmp.fieldbyname('Meter').AsString), 0) + FAddL);
|
||||
Yardage.Text := Trim(ADOTmp.fieldbyname('Yardage').AsString);
|
||||
finally
|
||||
FSyncing := False;
|
||||
end;
|
||||
UpdateCalcMeter();
|
||||
CodeTableLen.Text := Trim(ADOTmp.fieldbyname('code_table_length').AsString);
|
||||
|
||||
|
|
@ -348,7 +357,7 @@ begin
|
|||
sql.Add(' PieceNo=''' + Trim(PieceNo.Text) + ''' ');
|
||||
sql.Add(',GrossWeight=' + FloatToStr(Strtofloatdef(GrossWeight.Text, 0) - FAddW));
|
||||
sql.Add(',NetWeight=' + FloatToStr(Strtofloatdef(NetWeight.Text, 0) - FAddW));
|
||||
sql.Add(',Meter=' + FloatToStr(Strtofloatdef(Meter.Text, 0)));
|
||||
sql.Add(',Meter=' + FloatToStr(Strtofloatdef(Meter.Text, 0) - FAddL));
|
||||
sql.Add(',Yardage=' + FloatToStr(Strtofloatdef(Yardage.Text, 0)));
|
||||
sql.Add(',code_table_length=' + FloatToStr(Strtofloatdef(CodeTableLen.Text, 0)));
|
||||
|
||||
|
|
@ -414,34 +423,25 @@ end;
|
|||
|
||||
procedure TfrmTatInspEdit.UpdateCalcMeter();
|
||||
var
|
||||
MGrossW: Double;
|
||||
MNetW: Double;
|
||||
begin
|
||||
//CalcMeter = (GrossWeight含加重) / C_GramWeight,先取1位小数再按0.05/0.5规则进位(与TV3的CM2一致)
|
||||
MGrossW := StrToFloatdef(Trim(GrossWeight.Text), 0);
|
||||
//CalcMeter = (净重含加重) / 克重,四舍五入保留1位小数,不按0.05/0.5规则进位
|
||||
//(与检验页 CalcInputLenByWeightKZ 的 InputLen = RoundFloat((净重+加重)/克重,1) 一致)
|
||||
if Trim(NetWeight.Text) = '' then
|
||||
Exit;
|
||||
MNetW := StrToFloatdef(Trim(NetWeight.Text), 0);
|
||||
if FGramW > 0 then
|
||||
CalcMeter.Text := FormatFloat('0.#', RoundUpToHalf(RoundFloat(MGrossW / FGramW, 1)))
|
||||
CalcMeter.Text := FormatFloat('0.#', RoundFloat(MNetW / FGramW, 1))
|
||||
else
|
||||
CalcMeter.Text := '';
|
||||
end;
|
||||
|
||||
function TfrmTatInspEdit.RoundUpToHalf(AValue: Double): Double;
|
||||
var
|
||||
MIntPart: Double;
|
||||
procedure TfrmTatInspEdit.NetWeightChange(Sender: TObject);
|
||||
begin
|
||||
Result := AValue;
|
||||
if AValue <= 0 then
|
||||
//毛重框已隐藏:净重为唯一录入位,毛重与净重保持一致(毛重无OnChange,赋值不会递归)
|
||||
if FSyncing then
|
||||
Exit;
|
||||
MIntPart := Int(AValue);
|
||||
if Frac(AValue) < 0.05 then
|
||||
Result := MIntPart //integer, keep as is
|
||||
else if Frac(AValue) <= 0.5 then
|
||||
Result := MIntPart + 0.5 //decimal 0.1-0.4 -> 0.5
|
||||
else
|
||||
Result := MIntPart + 1; //decimal 0.6-0.9 -> next integer
|
||||
end;
|
||||
|
||||
procedure TfrmTatInspEdit.GrossWeightChange(Sender: TObject);
|
||||
begin
|
||||
GrossWeight.Text := NetWeight.Text;
|
||||
UpdateCalcMeter();
|
||||
end;
|
||||
|
||||
|
|
|
|||
|
|
@ -396,8 +396,8 @@
|
|||
Font.Name = #23435#20307
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
ReadOnly = True
|
||||
TabOrder = 0
|
||||
OnClick = CIFBegClick
|
||||
OnKeyPress = MJstr3KeyPress
|
||||
end
|
||||
object BTPrint: TButton
|
||||
|
|
@ -2933,10 +2933,6 @@
|
|||
object 查看: TcxTabSheet
|
||||
Caption = #26597#30475
|
||||
ImageIndex = 1
|
||||
ExplicitLeft = 0
|
||||
ExplicitTop = 0
|
||||
ExplicitWidth = 0
|
||||
ExplicitHeight = 0
|
||||
object cxGrid1: TcxGrid
|
||||
Left = 0
|
||||
Top = 0
|
||||
|
|
|
|||
|
|
@ -816,8 +816,8 @@ begin
|
|||
Loom.Text := FLoom;
|
||||
// Repairer.Text := Trim(ADOTmp.fieldbyname('Repairer').AsString);
|
||||
SetDdetails();
|
||||
InputLen.SetFocus;
|
||||
CIFBegClick(InputLen);
|
||||
InputWeight.SetFocus;
|
||||
CIFBegClick(InputWeight);
|
||||
end;
|
||||
end
|
||||
else
|
||||
|
|
@ -1899,8 +1899,8 @@ begin
|
|||
PrtData(FCIID);
|
||||
end;
|
||||
end;
|
||||
InputLen.SetFocus;
|
||||
CIFBegClick(InputLen);
|
||||
InputWeight.SetFocus;
|
||||
CIFBegClick(InputWeight);
|
||||
FOperationStatus := '²¼Æ±';
|
||||
InitJYGrid();
|
||||
InitCDGrid('');
|
||||
|
|
@ -2167,8 +2167,8 @@ begin
|
|||
SetDdetails();
|
||||
InitJYGrid();
|
||||
InitCDGrid('');
|
||||
InputLen.SetFocus;
|
||||
CIFBegClick(InputLen);
|
||||
InputWeight.SetFocus;
|
||||
CIFBegClick(InputWeight);
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
|
|
@ -2253,7 +2253,7 @@ begin
|
|||
FOperationStatus := '²¼Æ±';
|
||||
InitLCK(edtScan.Text);
|
||||
InitJYGrid();
|
||||
InputLen.SetFocus;
|
||||
InputWeight.SetFocus;
|
||||
end;
|
||||
end;
|
||||
procedure TfrmTatMachInsp.CIFBegClick(Sender: TObject);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user