USEGEAR

导航

ro多层的事务处理失败的困惑

现象:

'select a.WOD_No, a.WOM_FileLength,a.WOM_YanBuLength as WOM_Length,  a.My_YDP,a.My_YDPL,a.My_JDMS,a.My_JDL,a.My_ZJDL,a.My_JDYY   from WorkOrder_Detail a where isnull(a.WorkOrder_SFXZKC,0)=0 and   a.WOM_YanBuDatetime between '2014-04-11 17:38:29' and '2014-04-11 17:40:29''

在客户端用上面的语句取得数据,然后修改数据,通过RO的web service提交数据失败;

 

'select *  from WorkOrder_Detail a where isnull(a.WorkOrder_SFXZKC,0)=0 and   a.WOM_YanBuDatetime between '2014-04-11 17:38:29' and '2014-04-11 17:40:29'

在客户端用上面的语句取得数据,然后修改数据,通过RO的web service提交数据成功。

下面是保存提交数据code:

  Deltas := DeltaArray.Create;
  try
    if cds_MasterData_calc.ChangeCount > 0 then
      begin
        delta := Deltas.Add;
        tmp_sql := cds_MasterData_calc.CommandText;
        delta.ASQL := tmp_sql;
        delta.Delta := BinaryFromVariant(cds_MasterData_calc.Delta);
      end;
     if Deltas.Count>0 then
      begin
        with  DM.MyDM  do
          begin
            svc := CoDBCommonService.Create(ROBinMessage,ROWinInetHTTPChannel);
            if svc.ApplyUpdates(Deltas) then
              begin
                if cds_MasterData_calc.ChangeCount > 0 then  cds_MasterData_calc.MergeChangeLog;
                ShowMessage(MSG_Saver_ok);
              end
            else
              ShowMessage(MSG_Saver_err);
          end;
      end;
  finally
    Deltas.Free;
  end;
View Code


 

结果说明(貌似):

与后台Tdatesetprovider的更新方式有关。这里默认的UpdateMode=upWhereAll,是最苛刻的。估计是当所选数据不能满足upwhereall是出现保存失败。事情得过且过。没精力时间去测试探究出正在原因。

如果你知道请告诉我。

==================

看跟踪就明白Tdatesetprovider是如何干的,就明白为什么会有写失败的原因:

update [WorkOrder_Detail]  set
 [WOD_No] = :1,
 [WOM_FileLength] = :2
where
 [WOD_No] = :3 and
 [WOM_No] = :4 and
 [WOM_ThisBarcode] = :5 and
 [WOM_JH] = :6 and
 [WOM_PH] = :7 and
 [WOM_FileLength] = :8 and
 [WOM_Length] = :9 and
 [WOM_XiaJiDatetime] = :10 and
 [WOM_ParentNo] = :11 and
 [WOM_SFMJ] = :12 and
 [WOM_Grade] is null and
 [CD_Name] is null and
 [PL_Code] is null and
 [PL_Name] = :13 and
 [WOD_KCR] = :14 and
 [WOD_PLName] = :15 and
 [WOD_SFMX] is null and
 [WOD_ShortMess] is null and
 [WOD_ShortMessTime] is null and
 [WRD_Sender] is null and
 [WKR_WFXML] = :16 and
 [WOM_YanBuLength] = :17 and
 [WOM_YanBuDatetime] = :18 and
 [CDC_workgroup] = :19 and
 [WOM_HX] is null and
 [WOM_JS] is null and
 [WOM_WS] is null and
 [WorkOrder_SFXZKC] is null and
 [My_YDP] is null and
 [My_YDPL] is null and
 [My_JDMS] is null and
 [My_JDL] is null and
 [My_ZJDL] is null and
 [My_JDYY] is null
:1(String[32],IN)='A99CE994808B49699AAAE76F78F282BA' 
:2(Float,IN)=210 
:3(String[32],IN)='16E565AD41FE4FDAAD9CD81DA061D791' 
:4(String[32],IN)='00AB736331D848FF95F296AE78560E39' 
:5(String[13],IN)='0221133731225' 
:6(String[4],IN)='A919' 
:7(String[1],IN)='6' 
:8(Float,IN)=211 
:9(Float,IN)=101.07 
:10(DateTime,IN)=2014-02-21 13:02:29 
:11(String[2],IN)='-1' 
:12(Boolean,IN)=True 
:13(String[6],IN)='5-打包' 
:14(String[6],IN)='余冬琴' 
:15(String[6],IN)='1-验布' 
:16(String[6],IN)='单志连' 
:17(Float,IN)=101.07 
:18(DateTime,IN)=2014-02-21 14:38:46 
:19(String[64],IN)='[  {emp_bm:'1121',name:'卞玉琴'}, {emp_bm:'1122',name:'余冬琴'}]'
View Code

 

 

posted on 2014-04-21 19:26  USEGEAR  阅读(299)  评论(0编辑  收藏  举报