写反审核操作插件报错Error: expect token
金蝶云社区-lilyxusi
lilyxusi
0人赞赏了该文章 2,706次浏览 未经作者许可,禁止转载编辑于2016年11月11日 09:15:10

写反审核操作插件报错,要实现的功能是反写上游单据的状态字段,是在DBServiceHelper.Execute(Context, sql);出现错误的,在数据库测试过sql语句是没有问题的,求老师指导!!!谢谢~
[{"operation":"KDY_PIS_T_RECEIPT.MBIClick.tbUnAudit"}]
发生时间:09:05:30
错误来源: Kingdee.BOS.SQL
错误信息:
Error: expect token , but current token is , at line 1, column 40)
===================================================
调用堆栈:
at Kingdee.BOS.SQL.Parser.UpdateParser.update() in d:\k3cloudbuild\BOS_V6_PT\BOS\Common\Src\Kingdee.BOS.SQL\Parser\UpdateParser.cs:line 75
at Kingdee.BOS.SQL.Parser.SqlStmtParser.update() in d:\k3cloudbuild\BOS_V6_PT\BOS\Common\Src\Kingdee.BOS.SQL\Parser\SqlStmtParser.cs:line 555
at Kingdee.BOS.SQL.Parser.SqlStmtParser.stmt() in d:\k3cloudbuild\BOS_V6_PT\BOS\Common\Src\Kingdee.BOS.SQL\Parser\SqlStmtParser.cs:line 105
at Kingdee.BOS.SQL.Parser.SqlStmtParser.stmtList(IList stmtCol, Token tok) in d:\k3cloudbuild\BOS_V6_PT\BOS\Common\Src\Kingdee.BOS.SQL\Parser\SqlStmtParser.cs:line 38
at Kingdee.BOS.SQL.TransUtil.getStmtList(String ksql) in d:\k3cloudbuild\BOS_V6_PT\BOS\Common\Src\Kingdee.BOS.SQL\TransUtil.cs:line 230
错误数据: System.Collections.ListDictionaryInternal
代码如下
[code] public override void EndOperationTransaction(EndOperationTransactionArgs e)
{
string targettable = this.BusinessInfo.Entrys[0].TableName;
string entitytable = this.BusinessInfo.Entrys[1].TableName;
long fid = e.DataEntitys[0]["Id"].ToIntFormat();

foreach (var obj in e.DataEntitys)
{
//该条单据体记录

var detailList = obj["FEntity"] as DynamicObjectCollection;

foreach (var detail in detailList)
{
string sql = string.Format("select FSOURCEBILLTYPE from {0} where FID='{1}'", entitytable, fid);
IDataReader ireader = DBServiceHelper.ExecuteReader(Context, sql);
if (ireader.Read())
{
string sourceablename = ireader[0].ToStringFormat();
Dictionary tabledic = GetBillTableName(sourceablename, detail["Id"].ToIntFormat());

ChangeSourceBill(tabledic, targettable, detail["Id"].ToStringFormat());
}
}
}
}
private void ChangeSourceBill(Dictionary billtable, string targettable, string targetentityid)
{
string sourcetable = billtable["单据体表名"];
if (!string.IsNullOrWhiteSpace(sourcetable) && !string.IsNullOrWhiteSpace(targettable))
{
string sql = string.Format("update {0} sd set sd.FSTOCKINQTY=0,sd.FMRPCLOSESTATUS='A' where sd.FENTRYID in (select tlk.FSID from {1}_LK tlk where tlk.FENTRYID='{2}') ", sourcetable, targettable, targetentityid);
int countnum = DBServiceHelper.Execute(Context, sql);
}
}[/code]