BlakeW
(Blake)
August 17, 2021, 3:43pm
1
Me again. When I run my loop it marks all other lines received but not the first one.
var recData = GetEFTest();
recData.ForEach(x => {
var item = new
{
poNum = x.po_number,
vendorNum = x.vendor_code,
packSlip = x.pack_slip_num,
poLine = x.pack_slip_num_line
};
var epiResponse = EpicorRest.EfxPost("ReceiptLib", "ReceiptMass", item);
if (epiResponse.IsErrorResponse)
{
print(epiResponse.ResponseError);
}
else
{
print($"success for poLine: {x.pack_slip_num_line}");
print(x.pack_slip_num_line);
x.interfaced = true;
x.interface_datetime = DateTime.Now;
db.SaveChanges();
}
});
Any idea why it would do this? I even tried setting received to true in the dataset on the function.
BlakeW
(Blake)
August 17, 2021, 5:41pm
2
I guess a question could be. Is there a way to add all 3 lines in the loop then update the dataset with all three lines instead of running each line through all of this in the function
cfinley
(Chance Finley)
August 17, 2021, 8:03pm
3
Are you able to manually mark the first line as received in epicor?
timshuwy
(Tim Shoemaker)
August 17, 2021, 10:27pm
4
have you tried switching the foreach out like this (plus a few other minor tweaks:)?
var recData = GetEFTest();
foreach (var recItem in recData) {
var item = new { poNum = recItem.po_number, vendorNum = recItem.vendor_code, packSlip = recItem.pack_slip_num, poLine = recItem.pack_slip_num_line };
var epiResponse = EpicorRest.EfxPost("ReceiptLib", "ReceiptMass", item);
if (epiResponse.IsErrorResponse) {
print(epiResponse.ResponseError);
} else {
print($"success for poLine: {item.pack_slip_num_line}");
print(item.pack_slip_num_line);
recItem.interfaced = true;
recItem.interface_datetime = DateTime.Now;
db.SaveChanges();
}
}
BlakeW
(Blake)
August 18, 2021, 11:34am
5
Yes without a problem. I can mark the individual line as received and received all on the header.
BlakeW
(Blake)
August 18, 2021, 11:40am
6
I have tried this sort of foreach loop as well. I also made another function just to mark the po all received and got nothing back. I also went into the dataset and marked it manually
BlakeW
(Blake)
August 18, 2021, 5:24pm
7
Is there a way to iterate through a function for all of the lines?