我在AX 2009中使用标准向导在查询中创建了AIF Web服务。现在看起来每件事都有效,除了更新。我无法写回“十进制”类型的字段。但“字符串”字段没有问题。
如果查看下面的代码,“PickQty”字段是小数,不起作用,“PickQtyMob”是一个字符串字段,无效。
如果我只更新PickQty,我会从AX中的服务进入更新,但不会进入parm方法。
我没有收到任何错误消息或异常。
更新的代码段: 尝试 { MOBBatchPickServiceUpdateRequest updateRequest = new MOBBatchPickServiceUpdateRequest(); updateRequest.MOBBatchPick = new AxdMOBBatchPick(); updateRequest.MOBBatchPick.BatchPick = new MOBBatchPickService.AxdEntity_BatchPick [1]; updateRequest.MOBBatchPick.BatchPick [0] = new MOBBatchPickService.AxdEntity_BatchPick();
updateRequest.EntityKeyList = new MOBBatchPickService.EntityKey[mobBatchPick.BatchPick.Length];
for (i = 0; i < mobBatchPick.BatchPick.Length; i++)
{
updateRequest.EntityKeyList[i] = new MOBBatchPickService.EntityKey();
updateRequest.EntityKeyList[i].KeyData = new MOBBatchPickService.KeyField[1];
updateRequest.EntityKeyList[i].KeyData[0] = new MOBBatchPickService.KeyField();
updateRequest.EntityKeyList[i].KeyData[0].Field = "PickRequestNum";
updateRequest.EntityKeyList[i].KeyData[0].Value = mobBatchPick.BatchPick[i].PickRequestNum;
mobBatchPick.BatchPick[i].PickQty = mobBatchPick.BatchPick[i].PickQty; // decimal: Doesn't work
mobBatchPick.BatchPick[i].PickQtyMob = mobBatchPick.BatchPick[i].PickQty.ToString(); // string: Works
mobBatchPick.BatchPick[i].action = MOBBatchPickService.AxdEnum_AxdEntityAction.update;
}// for
updateRequest.MOBBatchPick = mobBatchPick;
batchPickClient.update(updateRequest);
}
catch (Exception _exception)
{
MessageBox.Show(_exception.ToString());
}
答案 0 :(得分:0)
我通过将字段添加到AX中的initMandatoryFieldsMap方法解决了这个问题:
protected void initMandatoryFieldsMap()
{
super();
this.setParmMethodAsMandatory(classNum(AxMobBatchPick),methodStr(AxMobBatchPick,parmPickty));
}