summaryrefslogtreecommitdiff
path: root/src/app/api/stock-opname
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/api/stock-opname')
-rw-r--r--src/app/api/stock-opname/route.tsx34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/app/api/stock-opname/route.tsx b/src/app/api/stock-opname/route.tsx
index cba16e2..4c2dee4 100644
--- a/src/app/api/stock-opname/route.tsx
+++ b/src/app/api/stock-opname/route.tsx
@@ -183,26 +183,24 @@ const computeIsDifferent = async ({
const differenceQty = product.differenceQty
const allQty = onhandQty + differenceQty
- if (!isDifferent) {
- const conditional = {
- verificationCheckAll: verificationCounter > 0 && verificationCounter === stockOpnames.length,
- anyCountEqWithOnhand: [totalQty['COUNT1'], totalQty['COUNT2'], totalQty['COUNT3']].includes(onhandQty),
- anyCountEqWithAllQty: [totalQty['COUNT1'], totalQty['COUNT2'], totalQty['COUNT3']].includes(allQty),
- count1EqWithCount2: totalQty['COUNT1'] !== null && totalQty['COUNT2'] !== null && totalQty['COUNT1'] === totalQty['COUNT2'],
- count1EqWithCount3: totalQty['COUNT1'] !== null && totalQty['COUNT3'] !== null && totalQty['COUNT1'] === totalQty['COUNT3'],
- count2EqWithCount3: totalQty['COUNT2'] !== null && totalQty['COUNT3'] !== null && totalQty['COUNT2'] === totalQty['COUNT3'],
- }
-
- isDifferent = !(
- conditional.verificationCheckAll ||
- conditional.anyCountEqWithOnhand ||
- conditional.anyCountEqWithAllQty ||
- conditional.count1EqWithCount2 ||
- conditional.count1EqWithCount3 ||
- conditional.count2EqWithCount3
- )
+ const conditional = {
+ verificationCheckAll: verificationCounter > 0 && verificationCounter === stockOpnames.length,
+ anyCountEqWithOnhand: [totalQty['COUNT1'], totalQty['COUNT2'], totalQty['COUNT3']].includes(onhandQty),
+ anyCountEqWithAllQty: [totalQty['COUNT1'], totalQty['COUNT2'], totalQty['COUNT3']].includes(allQty),
+ count1EqWithCount2: totalQty['COUNT1'] !== null && totalQty['COUNT2'] !== null && totalQty['COUNT1'] === totalQty['COUNT2'],
+ count1EqWithCount3: totalQty['COUNT1'] !== null && totalQty['COUNT3'] !== null && totalQty['COUNT1'] === totalQty['COUNT3'],
+ count2EqWithCount3: totalQty['COUNT2'] !== null && totalQty['COUNT3'] !== null && totalQty['COUNT2'] === totalQty['COUNT3'],
}
+ isDifferent = !(
+ conditional.verificationCheckAll ||
+ conditional.anyCountEqWithOnhand ||
+ conditional.anyCountEqWithAllQty ||
+ conditional.count1EqWithCount2 ||
+ conditional.count1EqWithCount3 ||
+ conditional.count2EqWithCount3
+ )
+
await prisma.product.update({
where: { id: product.id },
data: { isDifferent }