我在 AX 2009 中使用来自查询的标准向导创建了一个 AIF Web 服务。现在看起来一切正常,除了更新。我无法从“十进制”类型中写回字段。但是“字符串”字段可以正常工作。
如果您查看下面的代码,“PickQty”字段是一个小数,它不起作用,而“PickQtyMob”是一个字符串字段,它起作用。
如果我只更新 PickQty,我会从 AX 中的服务而不是 parm 方法中进行更新。
而且我没有收到任何错误消息或异常。
更新代码片段:try { MOBBatchPickServiceUpdateRequest updateRequest = new MOBBatchPickServiceUpdateRequest(); updateRequest.MOBBatchPick = new AxdMOBBatchPick(); updateRequest.MOBBatchPick.BatchPick = 新 MOBBatchPickService.AxdEntity_BatchPick[1]; updateRequest.MOBBatchPick.BatchPick[0] = 新 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());
}