This commit is contained in:
ddf 2025-06-05 16:03:45 +08:00
parent c6a7b35639
commit 9442f505f0
3 changed files with 51 additions and 66 deletions

View File

@ -526,7 +526,7 @@ object frmClothInfoInput: TfrmClothInfoInput
object CostPrice: TcxCurrencyEdit object CostPrice: TcxCurrencyEdit
Tag = 2 Tag = 2
Left = 119 Left = 119
Top = 210 Top = 207
EditValue = 0.000000000000000000 EditValue = 0.000000000000000000
Properties.AssignedValues.DisplayFormat = True Properties.AssignedValues.DisplayFormat = True
Properties.OnEditValueChanged = CostPricePropertiesEditValueChanged Properties.OnEditValueChanged = CostPricePropertiesEditValueChanged

View File

@ -883,6 +883,19 @@ begin
RTSetsavedata(ADOQueryCmd, 'BS_Cloth_Info', panel2, 2); RTSetsavedata(ADOQueryCmd, 'BS_Cloth_Info', panel2, 2);
Post; Post;
end; end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select count(*) as AA from BS_Cloth_Info where C_Code=''' + Trim(C_Code.Text) + '''');
Open;
if FieldByName('AA').AsInteger > 1 then
raise Exception.Create('编号重复!');
end;
//////////////// 保存主表 //////////////////////
///
//////////////// 保存子布 //////////////////////
with ADOQueryCmd do with ADOQueryCmd do
begin begin
Close; Close;
@ -890,15 +903,15 @@ begin
sql.Add('delete BS_Cloth_Info_Link where ToID=''' + Trim(MaxBCIID) + ''''); sql.Add('delete BS_Cloth_Info_Link where ToID=''' + Trim(MaxBCIID) + '''');
ExecSQL; ExecSQL;
end; end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from BS_Cloth_Info_Link where 1=2');
Open;
end;
if Trim(C_FromName.Properties.LookupItems.Text) <> '' then if Trim(C_FromName.Properties.LookupItems.Text) <> '' then
begin begin
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from BS_Cloth_Info_Link where 1=2');
Open;
end;
with ADOQueryCmd do with ADOQueryCmd do
begin begin
Append; Append;
@ -912,13 +925,6 @@ begin
if Trim(C_FromName2.Properties.LookupItems.Text) <> '' then if Trim(C_FromName2.Properties.LookupItems.Text) <> '' then
begin begin
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from BS_Cloth_Info_Link where 1=2');
Open;
end;
with ADOQueryCmd do with ADOQueryCmd do
begin begin
Append; Append;
@ -932,13 +938,6 @@ begin
if Trim(C_FromName3.Properties.LookupItems.Text) <> '' then if Trim(C_FromName3.Properties.LookupItems.Text) <> '' then
begin begin
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from BS_Cloth_Info_Link where 1=2');
Open;
end;
with ADOQueryCmd do with ADOQueryCmd do
begin begin
Append; Append;
@ -952,13 +951,6 @@ begin
if Trim(C_FromName4.Properties.LookupItems.Text) <> '' then if Trim(C_FromName4.Properties.LookupItems.Text) <> '' then
begin begin
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from BS_Cloth_Info_Link where 1=2');
Open;
end;
with ADOQueryCmd do with ADOQueryCmd do
begin begin
Append; Append;
@ -972,13 +964,6 @@ begin
if Trim(C_FromName5.Properties.LookupItems.Text) <> '' then if Trim(C_FromName5.Properties.LookupItems.Text) <> '' then
begin begin
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from BS_Cloth_Info_Link where 1=2');
Open;
end;
with ADOQueryCmd do with ADOQueryCmd do
begin begin
Append; Append;
@ -989,18 +974,9 @@ begin
Post; Post;
end; end;
end; end;
//////////////// 保存子布 //////////////////////
with ADOQueryTemp do ///
begin //////////////// 保存供应商名称 //////////////////////
Close;
sql.Clear;
sql.Add('select count(*) as AA from BS_Cloth_Info where C_Code=''' + Trim(C_Code.Text) + '''');
Open;
if FieldByName('AA').AsInteger > 1 then
raise Exception.Create('编号重复!');
end;
with CDS_2 do with CDS_2 do
begin begin
First; First;
@ -1048,7 +1024,21 @@ begin
end; end;
end; end;
////////////////////////// 保存单位系数子表 ////////////////////////// with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add(' update BS_Cloth_Info_Sub set referencePrice= ISNULL(floatPrice, 0) + ISNULL(CostPrice, 0) ');
sql.Add(' from BS_Cloth_Info X ');
sql.Add(' where X.BCIID=BS_Cloth_Info_Sub.BCIID AND BS_Cloth_Info_Sub.BCIID =' + quotedstr(MaxBCIID));
ExecSQL;
end;
//////////////// 保存供应商名称 //////////////////////
///
////////////////////////// 保存单位系数子表 //////////////////////////
with CDS_3 do with CDS_3 do
begin begin
First; First;
@ -1095,7 +1085,7 @@ begin
Next; Next;
end; end;
end; end;
////////////////////////// 保存单位系数子表 //////////////////////////
ADOQueryCmd.Connection.CommitTrans; ADOQueryCmd.Connection.CommitTrans;
// with ADOQueryCmd do // with ADOQueryCmd do

View File

@ -278,9 +278,6 @@ var
begin begin
try try
ADOQueryCmd.Connection.BeginTrans; ADOQueryCmd.Connection.BeginTrans;
//////////////////////// ±£´æ×Ó±í ////////////////////////// //////////////////////// ±£´æ×Ó±í //////////////////////////
with CDS_4 do with CDS_4 do
begin begin
@ -290,11 +287,7 @@ begin
if Trim(CDS_4.fieldbyname('BCISID').AsString) = '' then if Trim(CDS_4.fieldbyname('BCISID').AsString) = '' then
begin begin
if GetLSNo(ADOQueryTemp, maxId4, 'YS', 'BS_Cloth_Info_Sub', 4, 1) = False then if GetLSNo(ADOQueryTemp, maxId4, 'YS', 'BS_Cloth_Info_Sub', 4, 1) = False then
begin raise Exception.Create('取子流水号失败!');
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('取子流水号失败!', '提示', 0);
Exit;
end;
end end
else else
begin begin
@ -333,26 +326,28 @@ begin
Next; Next;
end; end;
end; end;
with ADOQueryTemp do with ADOQueryTemp do
begin begin
Close; Close;
sql.Clear; sql.Clear;
sql.Add('select count(BCISID) as AA from BS_Cloth_Info_Sub where BCIID=''' + Trim(FBCIID) + ''''); sql.Add('select count(BCISID) as AA from BS_Cloth_Info_Sub where BCIID=''' + Trim(FBCIID) + '''');
sql.Add(' group by C_Color,C_ColorNo having count(BCISID)>1'); sql.Add(' group by C_Color,C_ColorNo having count(BCISID)>1');
// ShowMessage(sql.Text);
Open; Open;
end; end;
if StrToFloatDef(ADOQueryTemp.fieldbyname('AA').asstring, 1) > 1 then if StrToFloatDef(ADOQueryTemp.fieldbyname('AA').asstring, 1) > 1 then
raise Exception.Create('颜色色号重复!');
with ADOQueryCmd do
begin begin
ADOQueryCmd.Connection.RollbackTrans; Close;
// Result := False; SQL.Clear;
Application.MessageBox('颜色色号重复!', '提示', 0); sql.Add(' exec P_BS_CloInfo_ZhuBuTongBu @BCIID=' + QuotedStr(trim(FBCIID)));
Exit; ExecSQL;
end; end;
//////////////////////// ±£´æ×Ó±í ////////////////////////// //////////////////////// ±£´æ×Ó±í //////////////////////////
ADOQueryCmd.Connection.CommitTrans; ADOQueryCmd.Connection.CommitTrans;
Result := True; Result := True;