|
开发环境是2603,运行环境是2625
开发环境运行正常,但是运行环境报错,(错误切图见附件)
错误源代码:
var sqlStr:String;
ok:Integer;
H:TTransactionHandle;
begin
Query1.Close;
sqlStr:='SELECT COUNT(PRICE_CODE)aa FROM TB_SAL_FORMULA WHERE PRICE_CODE=''05'' AND (CUS_ID='''' or CUS_ID is null) AND STN_CODE=100';
Query1.CommandText:=sqlStr;
Edit6.Text:=sqlStr;
Query1.Execute;
Query1.Open;
if (Query1.FieldByName('aa').AsString='') or (SysUtils.StrToInt(Query1.FieldByName('aa').AsString)<1) then
begin
DataSetBroker1.DataSet.Open;
DataSetBroker1.DataSet.Insert;
DataSetBroker1.DataSet.FieldByName('FORMULA_DES').AsString:=Edit1.Text;
DataSetBroker1.DataSet.FieldByName('FORMULA_OPER').AsString:=Edit2.Text;
DataSetBroker1.DataSet.FieldByName('FORMULA_UDATE').AsString:=Edit3.Text;
DataSetBroker1.DataSet.FieldByName('FORMULA_AUDI_PER').AsString:=Edit4.Text;
DataSetBroker1.DataSet.FieldByName('FORMULA_AUDI_DATE').AsString:=Edit5.Text;
DataSetBroker1.DataSet.FieldByName('REMARK').AsString:=Memo1.Text;
DataSetBroker1.DataSet.FieldByName('FORMULA_NM').AsString:='统一中转公式:'+temp_Str;
DataSetBroker1.DataSet.FieldByName('PRICE_CODE').AsString:='05';
DataSetBroker1.DataSet.FieldByName('STN_CODE').AsString:='100';
DataSetBroker1.DataSet.ApplyUpdates;
JsDialogs.ShowMsg('统一中转价格公式添加成功!','提示');
end
else
begin
DataSetBroker1.DataSet.Locate('FORMULA_ID',GSBH,[]);
Refresh_Find(Sender);
if (DataSetBroker1.DataSet.FieldByName('FORMULA_AUDI_PER').AsString<>'') AND (DataSetBroker1.DataSet.FieldByName('FORMULA_AUDI_DATE').AsString<>'') then
begin
JsDialogs.ShowMsg('该公式被审核过,不能修改!','修改失败');
end
else
begin
ok:=JsDialogs.QuestionBox('是否要修改统一中价格公式吗?','提示',2);
if ok=6 then
begin
with InfoBrokerZGSGSXX.Info.DataSetByID('GSXX').Connection.Transaction do
begin
H:=Start(False);
try
sqlStr:='SELECT * from TB_SAL_FORMULA WHERE PRICE_CODE=''05'' AND (CUS_ID='''' or CUS_ID is null) AND STN_CODE=100';
Edit6.Text:=sqlStr;
Query1.Close;
Query1.Connection:=InfoBrokerZGSGSXX.Info.DataSetByID('GSXX').Connection;
Query1.CommandText:=sqlStr;
Query1.Execute;
Query1.Open;
//--------------------修改备份
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').Close;
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').Connection:=InfoBrokerZGSGSXX.Info.DataSetByID('GSXX').Connection;
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').Open;
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').Insert;
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').FieldByName('FORMULA_ID').AsString:=Query1.FieldByName('FORMULA_ID').AsString;
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').FieldByName('STN_CODE').AsString:=Query1.FieldByName('STN_CODE').AsString;
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').FieldByName('FORMULA_DES').AsString:=Query1.FieldByName('FORMULA_DES').AsString;
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').FieldByName('FORMULA_NM').AsString:=Query1.FieldByName('FORMULA_NM').AsString;
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').FieldByName('FORMULA_AUDI_PER').AsString:=Query1.FieldByName('FORMULA_AUDI_PER').AsString;
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').FieldByName('FORMULA_UDATE').AsString:=Query1.FieldByName('FORMULA_UDATE').AsString;
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').FieldByName('FORMULA_OPER').AsString:=Query1.FieldByName('FORMULA_OPER').AsString;
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').FieldByName('FORMULA_AUDI_DATE').AsString:=Query1.FieldByName('FORMULA_AUDI_DATE').AsString;
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').FieldByName('REMARK').AsString:=Query1.FieldByName('REMARK').AsString;
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').FieldByName('CUS_ID').AsString:=Query1.FieldByName('CUS_ID').AsString;
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').FieldByName('PRICE_CODE').AsString:=Query1.FieldByName('PRICE_CODE').AsString;
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').FieldByName('DEFAULT_ID').AsString:=Query1.FieldByName('DEFAULT_ID').AsString;
//备份类型 =0 修改
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').FieldByName('BFLX').AsString:='0';
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').ApplyUpdates;
sqlStr:='update TB_SAL_FORMULA set FORMULA_DES='''+Edit1.Text+''' ,'
+'FORMULA_OPER='''+Edit2.Text+''' ,FORMULA_UDATE=to_date('''+Edit3.Text+''''+','+ '''yyyy-MM-dd HH24:MI:SS'''+') ,'
+'REMARK='''+Memo1.Text+''' '
+' WHERE PRICE_CODE=''05'' AND (CUS_ID='''' or CUS_ID is null) AND STN_CODE=100';
Query1.Close;
Query1.Connection:=InfoBrokerZGSGSXX.Info.DataSetByID('GSXX').Connection;
Edit6.Text:=sqlStr;
Query1.CommandText:=sqlStr;
Query1.Execute;
Commit(H);
Except
Rollback(H);
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').Close;
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').Open;
InfoBrokerZGSGSXX.Info.DataSetByID('GSBF').Refresh;
JsDialogs.ShowMsg('统一中转价格公式修改成功!','提示');
end;
end;
end;
GSBH:='';
end;
end;
end;
|
|