to get a personalized navigation.
to get a personalized navigation.
I have noticed an possible issue when doing FinishNow on an orderline, when I run the following mutation:
mutation
{
useCompany(no: 4816282)
{
mutationResult : orderLine_update
(
filters: [ {_and :[{orderNo :{_eq:4030}},{lineNo :{_eq:1}}]} ],
values:[{finishNow:10.000}]
)
{
affectedRows
items
{
finished
finishDateAsDate
finishAtAsTime
}
}
}
}
In this case no qty was finsihed on this orderline before, so I expected the following result:
{
"data": {
"useCompany": {
"mutationResult": {
"affectedRows": 1,
"items": [
{
"finished": 10,
"finishDateAsDate": "2024-03-11",
"finishAtAsTime": "15:19"
}
]
}
}
},
"extensions": {
"vbnxt-trace-id": "000000000000000069526ed798ecabd8"
}
}
But I get this result:
{
"data": {
"useCompany": {
"mutationResult": {
"affectedRows": 1,
"items": [
{
"finished": 0,
"finishDateAsDate": "2024-03-11",
"finishAtAsTime": "15:19"
}
]
}
}
},
"extensions": {
"vbnxt-trace-id": "000000000000000069526ed798ecabd8"
}
}
If I then run a query on that orderline I get the correct finished qty.
My question is why I don't get this back when doing the mutation ?
In my code I do get the correct finished qty if I do a query directly after I have done the mutation but in my view I should not have to do that query because the mutation should project those values back.
Could it be that the mutation returns to quickly before the finish processing has been completed ?
I believe I reproduced what you're describing (although maybe a bit differently).
I created and order with a single line, quantity 10. The order looked like this:
{
"data": {
"useCompany": {
"order": {
"items": [
{
"orderNo": 1489,
"orderDate": 20240319,
"joindown_OrderLine_via_Order": {
"items": [
{
"orderNo": 1489,
"lineNo": 1,
"productNo": "101",
"quantity": 10,
"finished": 0,
"finishDateAsDate": "0001-01-01",
"finishAtAsTime": "00:00"
}
]
}
}
]
}
}
}
}
Next, I ran the mutation you shown, trying to finish 10. The result I got was:
{
"data": {
"useCompany": {
"mutationResult": {
"affectedRows": 1,
"items": [
{
"finished": 0,
"finishDateAsDate": "0001-01-01",
"finishAtAsTime": "00:00"
}
]
}
}
}
}
This means nothing was finished. If I read the order again, I get the same values as previously:
"items": [
{
"orderNo": 1489,
"lineNo": 1,
"productNo": "101",
"quantity": 10,
"finished": 0,
"finishDate": 0,
"finishDateAsDate": "0001-01-01",
"finishAtAsTime": "00:00"
}
If I run the finish processing
mutation finish_order($cid : Int!,
$ono : Int!,
$pno : String)
{
useCompany(no : $cid)
{
order_processings
{
finish(
filter: {orderNo:{_eq : $ono}},
args : {
finishType : 2,
group : {
key : $pno, quantity : 10.0
}
}
)
{
succeeded
items
{
handledOrderLine
{
lineNo
finishedNow
}
}
}
}
}
}
it is reported that 10 items were finished:
{
"data": {
"useCompany": {
"order_processings": {
"finish": {
"succeeded": true,
"items": [
{
"handledOrderLine": [
{
"lineNo": 1,
"finishedNow": 10
}
]
}
]
}
}
}
}
}
But when I read the order, it looks like the quantity is unchanged, and nothing is finished:
"items": [
{
"orderNo": 1489,
"lineNo": 1,
"productNo": "101",
"quantity": 10,
"finished": 0,
"finishDate": 0,
"finishDateAsDate": "0001-01-01",
"finishAtAsTime": "00:00"
}
This is not a GraphQL issue. But we need some input from someone that knows better (than me) the business logic here.
Copyright © 2022 Visma.com. All rights reserved.